Composites
Suggestions
Starter and follow-up prompt chips that ripple in and report stable IDs.
Starts when it scrolls into view
NORD FROST · DARK · RADIUS 6/10 · BASE 16PX · SHADOW
- Type
Suggestions- Source
suggestions.rs- Story
suggestions- Demo height
- 132 px
- Events
- SuggestionsEvent
Code
Cut from the gallery story this page runs, so it stays true.
let tokens = cx.theme().semantic_tokens();
let status: SharedString = match &self.last_suggestion {
Some(id) => format!("Selected: {id}").into(),
None => "Choose a suggestion".into(),
};
v_flex()
.gap(tokens.spacing.md)
.child(
Suggestions::new("starter-suggestions")
.items([
Suggestion::new("compare", "Compare supplier prices")
.description("Sends the prompt immediately"),
Suggestion::new("risk", "Explain this week's delivery risk"),
Suggestion::new("draft", "Draft the order confirmations"),
Suggestion::new("history", "Show the price history"),
])
.on_event(cx.listener(|this, event: &SuggestionsEvent, _, cx| {
let SuggestionsEvent::Selected { id } = event;
this.last_suggestion = Some(id.clone());
cx.notify();
})),
)
.child(
div()
.id("suggestions-story-status")
.role(Role::Status)
.aria_label(status.clone())
.text_xs()
.text_color(cx.theme().muted_foreground)
.child(status),
)
Events and ownership
- Who owns the state
- Suggestions renders state supplied by the application; it does not own durable work.
- What it emits
- Interactive intent is reported through the typed SuggestionsEvent contract and stable application IDs.
- What it means
- Starter and follow-up prompt chips that ripple in and report stable IDs.
- Overflow and motion
- Wide content retains context in a bounded surface; reduced motion preserves a useful state.
Event types
- SuggestionsEvent
What the demo does and does not show
The demo above is the same Rust as the native component, compiled to WebAssembly and drawn on a WebGPU canvas — not a mock-up, a recording, or a re-implementation. What it paints is what the component paints: layout, colour from the live theme, and motion.
The live browser specimen requires WebGPU; the native component remains the authoritative runtime.
A canvas cannot stand in for the platform, so treat everything that goes through the operating system as unproven here: keyboard handling and shortcuts, screen reader semantics, text input and IME, the clipboard, file drops, and the frame rate you would get on your own GPU. Judge those in a native build. If your browser has no WebGPU, the frame says so rather than showing an empty box.