Suggestion
Prompt starters in a row that scrolls, one click away from being sent.
Installation
Copy and paste the following code into your project.
Update the import paths to match your project structure.
Anatomy
onClick receives the suggestion text, not the event, so the handler that sends a message can be passed straight in without a wrapper closure per item.Composition
Use the following composition to build a
Suggestion:Variants
Three visual weights and three sizes.
outline is the default and reads as a control; secondary sits on a filled surface; ghost disappears until hovered, which suits a dense list under a composer.API Reference
Suggestion
| Prop | Type | Default | Description |
|---|---|---|---|
suggestion | string | - | Text shown and passed to onClick |
onClick | (suggestion: string) => void | - | Called with the suggestion text |
variant | 'outline' | 'secondary' | 'ghost' | 'outline' | Visual treatment |
size | 'sm' | 'md' | 'lg' | 'md' | Control height |
children | ReactNode | - | Replaces the label, keeps the payload |
className | string | - | Additional CSS classes |
Suggestion.Group
| Prop | Type | Default | Description |
|---|---|---|---|
wrap | boolean | false | Wraps chips onto new lines instead of scrolling them sideways |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.