Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Suggestion

Prompt chips that fill the input when you click one.

Installation

pnpm add @heyramzi/ui

Usage

import { Suggestions, Suggestion } from "@heyramzi/ui/ai/suggestion";
<Suggestions>
  {#each ideas as idea (idea)}
    <Suggestion suggestion={idea} onclick={(text) => (value = text)} />
  {/each}
</Suggestions>

Keyboard and accessibility

Key Does
Tab Moves focus to the next suggestion.
Space Enter Picks the focused suggestion.
  • The row is a group named "Suggestions". Pass label to say more, like "Suggested prompts".

API reference

Suggestions.Suggestion

suggestion required string
onclick (suggestion: string) => void
class string
children import("svelte").Snippet
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed"
Default "outline"
size "sm" | "default" | "lg"
Default "sm"
icon boolean
ref HTMLButtonElement | HTMLAnchorElement | null
...rest
Every prop of HTMLButtonAttributes from svelte/elements except children, onclick
...rest
Every prop of HTMLAnchorAttributes from svelte/elements except children, onclick
Prop Type Default
suggestion required string
onclick (suggestion: string) => void
class string
children import("svelte").Snippet
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed" "outline"
size "sm" | "default" | "lg" "sm"
icon boolean
ref HTMLButtonElement | HTMLAnchorElement | null
...rest Every prop of HTMLButtonAttributes from svelte/elements except children, onclick
...rest Every prop of HTMLAnchorAttributes from svelte/elements except children, onclick

Suggestions.Suggestions

children Snippet
label string
Default "Suggestions"
The group's name for a screen reader.
class string
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
children Snippet
label

The group's name for a screen reader.

string "Suggestions"
class string
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements