About
A rich Astryx chat input supporting trigger menus, inline tokens, message history, file handling, and accessible submission.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Chat Composer Input to your project and fits it to your theme.
Code
How Astryx Chat Composer Input is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
'use client';
import {useState} from 'react';
import {
ChatComposer,
ChatComposerInput,
type ChatComposerTrigger,
} from '@/components/ui/astryx-chat-composer-input';
import {createStaticSource} from '@astryxdesign/core/Typeahead';
import type {SearchableItem} from '@astryxdesign/core/Typeahead';
import {Stack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';
const USERS: SearchableItem[] = [
{id: 'cindy', label: 'Cindy Zhang'},
{id: 'alex', label: 'Alex Johnson'},
{id: 'sam', label: 'Sam Rivera'},
{id: 'jordan', label: 'Jordan Lee'},
];
const COMMANDS: SearchableItem[] = [
{id: 'summarize', label: 'summarize'},
{id: 'translate', label: 'translate'},
{id: 'search', label: 'search'},
{id: 'code', label: 'code'},
];
const userSource = createStaticSource(USERS);
const commandSource = createStaticSource(COMMANDS);
function ChatComposerInputMultipleTriggers() {
const [value, setValue] = useState('');
const mentionTrigger: ChatComposerTrigger = {
character: '@',
searchSource: userSource,
onSelect: item => ({
value: `@${item.id}`,
label: item.label,
variant: 'blue' as const,
}),
};
const commandTrigger: ChatComposerTrigger = {
character: '/',
searchSource: commandSource,
onSelect: item => ({
value: `/${item.label}`,
label: `/${item.label}`,
variant: 'yellow' as const,
}),
};
return (
<Stack direction="vertical" gap={3} width={450} maxWidth="100%">
<Text type="supporting" color="secondary">
Type @ for mentions (blue) or / for commands (yellow)
</Text>
<ChatComposer
onSubmit={() => setValue('')}
input={
<ChatComposerInput
value={value}
onChange={setValue}
triggers={[mentionTrigger, commandTrigger]}
placeholder="Type @ or / ..."
/>
}
/>
<Text type="supporting" color="secondary">
Value: {JSON.stringify(value)}
</Text>
</Stack>
);
}
export default function ChatComposerInputMultipleTriggersDemo() {
return (
<div
data-astryx-theme="neutral"
data-theme="light"
style={{colorScheme: 'light', display: 'contents'}}>
<ChatComposerInputMultipleTriggers />
</div>
);
}






