gpui-ai

Evidence

Context cards

Compact source context that preserves provenance and readable detail.

Context cards — 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 216 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
context
Demo height
216 px
Events
ContextCardEvent

Code

Cut from the gallery story this page runs, so it stays true.

crates/gallery/src/gallery.rsOpen in the galleryImplementation
v_flex()
    .gap_2()
    .child(
        ContextCard::new("ctx-1", "pricing.md")
            .snippet(
                "Enterprise volume pricing is renegotiated quarterly; \
                 the March sheet supersedes all prior quotes.",
            )
            .relevance(0.92)
            .on_event(cx.listener(|_, event: &ContextCardEvent, _, _| {
                println!("context event: {event:?}");
            })),
    )
    .child(
        ContextCard::new("ctx-2", "suppliers.csv")
            .snippet("Alpenrose Dairy, Portland OR, net-30, 4.8 rating")
            .relevance(0.81),
    )

Events and ownership

Who owns the state
ContextCard renders state supplied by the application; it does not own durable work.
What it emits
Interactive intent is reported through the typed ContextCardEvent contract and stable application IDs.
What it means
Compact source context that preserves provenance and readable detail.
Overflow and motion
Wide content retains context in a bounded surface; reduced motion preserves a useful state.

Event types

  • ContextCardEvent

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.