Suggestions

Starter prompts, offered before the first message. Buttons rather than a list, because each one performs an action.

src/components/ui/suggestions.tsx

About

From the component's own source, where it was written.

Starter prompts, offered before the first message.

Buttons rather than a list: each one performs an action, and the pill shape signals "tap me" in a way a bulleted list does not.

Install

npx astralyx-ui add suggestions

Usage

import { Suggestions } from '@/components/ui/suggestions'

<Suggestions items={prompts} onSelect={send} />

Composer

Change the props and the source below follows.

Props
tsx
<Suggestions
  items={['Explain the colour sets', 'Add a component']}
  onSelect={send}
/>

Examples

Starter prompts

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

Suggestions

Starter prompts, offered before the first message.

Extends Omit<ComponentProps<'div'>, 'onSelect'>.

PropTypeDefaultDescription
itemsstring[]requiredThe prompts.
onSelect(prompt: string) => void—Fires with the chosen prompt.