Suggestions
A row of prompt chips for under a chat input. One tab stop, arrow keys, edge fades while it scrolls.
New in 1.7.
A chip fills the prompt. Edit it, then press Enter.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/suggestions.jsonUsage
import { Suggestion, Suggestions } from "@/components/ui/suggestions"
<Suggestions onSelect={(text) => setPrompt(text)}>
<Suggestion>Why did deploy #4127 fail?</Suggestion>
<Suggestion>Summarize PR #482 for review</Suggestion>
</Suggestions>Examples
Send on click
When a chip is the whole question, onSelect can send it. Asked ones are disabled, and arrow keys skip them.
One scrolling row
Without wrap the row scrolls sideways, and each edge fades only while chips are hidden past it.
API reference
Suggestions
A div with role="toolbar". Accepts div attributes; the ref points at it.
| Prop | Type | Default |
|---|---|---|
onSelect | (value: string) => voidCalled with the picked chip's value, or its text. Fill an input or send it. | None |
wrap | booleanWraps onto more lines from the sm breakpoint up. Below it the row always scrolls. | false |
size | "sm"28px or 32px chips. | "md" |
disabled | booleanDisables every chip, for example while a reply streams. | false |
aria-label | stringNames the row. Say what the chips are for. | "Suggestions" |
color | NeonColorHover border and icon color. Falls back to --neon-accent, then cyan. | inherited |
Suggestion
A button. Accepts button attributes; onClick runs first and can preventDefault to skip onSelect.
| Prop | Type | Default |
|---|---|---|
value | stringWhat onSelect receives. Defaults to the chip's text. | None |
icon | ReactNodeShown before the text. It lights when the chip is hovered or focused. | None |
disabled | booleanSkipped by the arrow keys. | false |
Accessibility
- The row is one tab stop. Arrow keys move between chips (both axes, wrapping, mirrored in RTL), Home and End jump to the ends.
- A focused chip scrolls clear of the faded edge.
- A picked chip flares once. With reduced motion it doesn't.
- Chips are plain children, so render them from any list and swap the list as the conversation moves on.