Composites
Message queue
Prompts waiting while the agent runs, with reorder, edit, send-now, remove, and clear by stable ID.
Starts when it scrolls into view
NORD FROST · DARK · RADIUS 6/10 · BASE 16PX · SHADOW
- Type
MessageQueue- Source
queue.rs- Story
queue- Demo height
- 242 px
- Events
- QueueEvent
Code
Cut from the gallery story this page runs, so it stays true.
let tokens = cx.theme().semantic_tokens();
let status: SharedString = self
.last_queue_event
.clone()
.unwrap_or_else(|| "Reorder, edit, send now, or remove a waiting prompt".into());
v_flex()
.gap(tokens.spacing.md)
.child(
MessageQueue::new("queue")
.items(self.queued.iter().cloned())
.editable(true)
.on_event(cx.listener(|this, event: &QueueEvent, _, cx| {
match event {
QueueEvent::Removed { id } | QueueEvent::SentNow { id } => {
this.queued.retain(|item| item.id() != id);
}
QueueEvent::MovedUp { id } => {
if let Some(index) =
this.queued.iter().position(|item| item.id() == id)
&& index > 0
{
this.queued.swap(index, index - 1);
}
}
QueueEvent::MovedDown { id } => {
if let Some(index) =
this.queued.iter().position(|item| item.id() == id)
&& index + 1 < this.queued.len()
{
this.queued.swap(index, index + 1);
}
}
QueueEvent::EditRequested { .. } => {}
QueueEvent::Cleared => this.queued.clear(),
}
this.last_queue_event = Some(format!("{event:?}").into());
cx.notify();
})),
)
.when(self.queued.is_empty(), |this| {
this.child(
Button::new("queue-refill")
.outline()
.small()
.text_label("Queue the demo prompts again")
.on_click(cx.listener(|this, _, _, cx| {
this.queued = demo_queue();
this.last_queue_event = Some("Refilled".into());
cx.notify();
})),
)
})
.child(
div()
.id("queue-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
- MessageQueue renders state supplied by the application; it does not own durable work.
- What it emits
- Interactive intent is reported through the typed QueueEvent contract and stable application IDs.
- What it means
- Prompts waiting while the agent runs, with reorder, edit, send-now, remove, and clear by stable ID.
- Overflow and motion
- Wide content retains context in a bounded surface; reduced motion preserves a useful state.
Event types
- QueueEvent
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.