Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

chore(storybook): ChatComposerInput punctuation trigger story (#7553)

Cindy Zhang9d2b65628e70
diff --git a/apps/storybook/stories/ChatComposerInput.stories.tsx b/apps/storybook/stories/ChatComposerInput.stories.tsx
index 24734cc449..ca6c72df50 100644
--- a/apps/storybook/stories/ChatComposerInput.stories.tsx
+++ b/apps/storybook/stories/ChatComposerInput.stories.tsx
@@ -77,6 +77,16 @@ const COMMANDS: SearchableItem<{description: string}>[] = [
const userSource = createStaticSource(USERS);
const commandSource = createStaticSource(COMMANDS);
+const EMOJIS: SearchableItem[] = [
+ {id: 'smile', label: 'smile (πŸ˜„)'},
+ {id: 'heart', label: 'heart (❀️)'},
+ {id: 'thumbsup', label: 'thumbsup (πŸ‘)'},
+ {id: 'fire', label: 'fire (πŸ”₯)'},
+ {id: 'rocket', label: 'rocket (πŸš€)'},
+ {id: 'sparkles', label: 'sparkles (✨)'},
+];
+const emojiSource = createStaticSource(EMOJIS);
+
const asyncUserSource: SearchSource = {
search(query: string) {
return new Promise(resolve => {
@@ -771,3 +781,27 @@ export const GroupedItems: Story = {
);
},
};
+
+/** Punctuation trigger (e.g. emoji picker) β€” type : to see the menu */
+export const PunctuationTrigger: Story = {
+ render: () => {
+ const emojiTrigger: ChatComposerTrigger = {
+ character: ':',
+ searchSource: emojiSource,
+ renderItem: item => <TypeaheadItem item={item} />,
+ onSelect: item => `:${item.id}: `,
+ };
+
+ return (
+ <ChatComposer
+ onSubmit={value => alert(`Sent: ${value}`)}
+ input={
+ <ChatComposerInput
+ triggers={[emojiTrigger]}
+ placeholder="Type : to see emoji suggestions..."
+ />
+ }
+ />
+ );
+ },
+};