gpui-ai

Composites

Prompt bar

A hybrid-controlled composer with mentions, commands, models, and attachments.

Prompt bar — gpui-ai

Starts when it scrolls into view

Pop out

NORD FROST · DARK · RADIUS 6/10 · BASE 16PX · SHADOW

Running the real component, compiled to WebAssembly. The frame is 432 px tall, which is what this story measures at the demo width in the default type size — a narrower column or a theme that changes that size will wrap it differently.
Story
prompt-bar
Demo height
432 px
Events
PromptBarEvent

Code

Cut from the gallery story this page runs. The states above change what the demo is given rather than how it is built, so they share this code.

crates/gallery/src/gallery.rsOpen in the galleryImplementation
let mut prompt = PromptBar::new("gallery-chat-prompt", window, cx);
prompt.set_models(
    [
        PromptModel::new("balanced", "Balanced")
            .provider("Anthropic")
            .description("Claude Sonnet 5 · everyday work")
            .context_window(200_000),
        PromptModel::new("fast", "Fast")
            .provider("Anthropic")
            .description("Claude Haiku 4.5 · quick replies")
            .context_window(200_000),
    ],
    cx,
);
prompt.set_selected_model("balanced", cx);
prompt.set_mentions([PromptMention::new("suppliers", "Suppliers")], cx);
prompt.set_commands(
    [PromptCommand::new("compare", "compare")
        .description("Compare current supplier context")],
    cx,
);
prompt.set_attachments([PromptAttachment::new("pricing", "pricing.md")], cx);
prompt.set_draft("Ask a follow-up about suppliers", window, cx);
prompt

Events and ownership

Who owns the state
PromptBar renders state supplied by the application; it does not own durable work.
What it emits
Interactive intent is reported through the typed PromptBarEvent contract and stable application IDs.
What it means
A hybrid-controlled composer with mentions, commands, models, and attachments.
Overflow and motion
Growing content remains reachable in a bounded vertical surface; reduced motion preserves a useful state.

Event types

  • PromptBarEvent

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.