Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Web docs
Forms

PromptSuggestions

Offers starter prompts that fill a PromptComposer, so an empty conversation has a clear first step.

Frameworks
Astro · React · Elements · Dioxus
Registry
lumen add PromptSuggestions
Interaction
Enhanced runtime
01

See it and copy it

Framework example

Choose Astro, React, Elements, or Dioxus to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroCode target · live preview uses Astro
View PromptSuggestions code

Framework usage

Switch targets to compare the adapter code. This live preview runs the Astro example. Before copying an example, complete the matching framework setup; React, Elements, and Dioxus use their own behavior APIs.Width controls resize the preview container. Resize your browser to test viewport breakpoints.
astro
---
import { PromptComposer, PromptSuggestions, Stack } from '@santi020k/lumen-astro'
---

<Stack gap="related">
  <PromptSuggestions
    suggestions={[
      { label: 'Summarize the release', value: 'Summarize the changes in this release.' },
      { label: 'Find breaking changes', value: 'List the breaking changes and how to migrate each one.' },
      { label: 'Draft release notes' }
    ]}
    target="suggestion-prompt"
  />
  <PromptComposer id="suggestion-prompt" label="Ask about your project" />
</Stack>
Edit PromptSuggestions in browser

Framework differences

React: PromptComposer puts its id on the form, so target the form id. onSuggestionSelect receives the chosen prompt.

Elements: Pass suggestions as a JSON attribute or through the suggestions property. Astro expression bindings are not HTML attributes.

02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add PromptSuggestions

API reference

Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.

AttributeValuesDefaultDescription
suggestions{ label: string; value?: string }[]requiredStarter prompts. value defaults to label, and blank labels are skipped. Nothing renders without suggestions or children.
targetid-The id of a PromptComposer textarea or form. Choosing a suggestion fills it and moves focus to the text.
submitOnSelectbooleanfalseSubmits the composer after filling it. Use it only for prompts that are complete. Elements uses submit-on-select.
disabledbooleanfalseDisables every suggestion.
labelstringSuggested promptsNames the suggestion group.
onSuggestionSelect / ui:prompt-suggestion{ value: string }-React callback or cancelable runtime event. Cancel the event to handle the prompt yourself instead of filling the composer.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Customize PromptSuggestions

Start with semantic theme tokens and a class on the public component. Keep its accessible name, focus treatment, and interaction state intact.

cssScoped theme overrides
.product-prompt-suggestions {
  --surface: 0 0% 100%;
  --ink: 220 20% 15%;
  --line: 220 15% 82%;
}

Apply product-prompt-suggestions through Astro's class, React's className, or the custom element's class. Verify foreground and background contrast in both schemes.

HookValuesDefaultContract
class, classNamestring""Merges custom classes with the generated ui-* root classes.

Use the documented hooks above and adapter types when targeting component states. Theme guide · Accessibility verification scope

Keyboard interactions

Keyboard behavior provided by the Astro UIPrimitives runtime for this component.

KeyAction
TabMove between suggestions.
Enter / SpacePut the suggestion into the target composer and move focus to its text.

Runtime events

CustomEvents dispatched by the Astro UIPrimitives runtime for this component.

EventTargetDetailWhen
ui:prompt-suggestionPromptSuggestions root ([data-ui-prompt-suggestions] or lumen-prompt-suggestions)LumenPromptSuggestionDetail: { value: string }Cancelable. Bubbles when a suggestion is chosen. Unless canceled, the prompt fills the target composer and submits it with submitOnSelect. React also calls onSuggestionSelect.

Web docsFull catalog