Get started
Forms
- Label
- Icon label
- Field
- Form
- Frontmatter form
- Questionnaire
- Input
- Input group
- Input OTP
- Password input
- Password strength
- Code input
- Number field
- Tag input
- Textarea
- Checkbox
- Radio group
- Language toggle group
- Emoji appearance toggle group
- Emoji picker
- Avatar picker
- AI provider picker
- Select
- Native select
- Combobox
- Language combobox
- Slider
- Calendar
- Switch
Display
- Alert
- Avatar
- Badge
- Card
- AI provider card
- Model info card
- Model list
- Empty
- Item
- Tree item
- File tree
- Icon media
- File type icon
- Font preview
- Image preview
- Kbd
- Table
- Data table
- Data table column header
- Chart
- Code Block
- Code card
- Markdown view
- Attachment
- Bubble
- Marker
- Message
- Chat message
- Chat suggestion item
- Message scroller
- Trace
- Progress
- Spinner
- Sonner
- Toast
- Unsaved changes toolbar
- Unsaved indicator
- Status indicator
- Permission card
- Separator
- Skeleton
- Animated grid pattern
- Meteors
Layout
One starter prompt in an empty conversation, an Item drawn as a button that hands its prompt to onSelectPrompt when pressed.
Installation#
bash
pnpm dlx shadcn@latest add @zui/chat-suggestion-itemThe CLI writes components/data-entry/chat-suggestion-item.tsx and installs
Item and Utils.
Usage#
tsx
import { ChatSuggestionItem } from '@/components/data-entry/chat-suggestion-item';tsx
<Empty>
<EmptyHeader>
<EmptyTitle>Start a conversation</EmptyTitle>
</EmptyHeader>
<EmptyContent>
<ItemGroup>
<ChatSuggestionItem prompt="Summarise this document" onSelectPrompt={send}>
<ItemMedia variant="icon">
<Icon as={FileText} />
</ItemMedia>
<ItemContent>
<ItemTitle>Summarise</ItemTitle>
</ItemContent>
</ChatSuggestionItem>
</ItemGroup>
</EmptyContent>
</Empty>Use it for the starter prompts of an empty conversation, inside an Empty state.
API reference#
ChatSuggestionItem#
Takes every prop of React Native's Pressable, plus:
| Prop | Type | Default |
|---|---|---|
prompt | string | required |
onSelectPrompt | (prompt: string) => void | - |
A small Item, announced as a button named by its content. Pressing it hands
prompt to onSelectPrompt, after the caller's onPress, unless that handler called event.preventDefault().
Without onSelectPrompt it is disabled, a read-only preview, unless disabled says otherwise; a disabled item stays
announced, as dimmed. Its background turns muted while it is held down and enabled.
Differences from the web#
onPressstands in for the web'sonClick, and pressing for hovering: the muted background the web draws while the item is hovered shows while it is pressed.- The web's
text-leftis not set; a Text starts at the leading edge already. - The web's
data-slotattribute is not set; a Pressable takes no data attributes.