Composer
The prompt box for an agent, in six layouts: send and stop, queue or steer while it works, model, effort and context in reach, attachments, and a reason when sending is off.
oxyn add composerrsx! {
Composer {
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Rendered from Rust at build time · goes live when visible
When to use
- The composer is where the user hands work to the agent and where they keep steering it while it runs.
- In an agent app it is not a text box with a button: it is a control surface that carries model, effort, mode, permissions, context, attachments, voice, a queue of follow-ups and the live status of the run.
- The richest references pack most of these into one composer (Pitus [R021]: mic, ✓ confirm, effort "Medium" with signal bars; Cloudy [R007]: steer-in-place, pause/stop, budget; BoardUI [R036]: Devin concept [R033]: split send; T3 Code [R003]: "Full access / Supervised" and branch under the composer). coss ui's Composer API (MIT) [R126] is our reference for the draft / trigger / submit model underneath (research note 17).
When not to use
- Prompt composer with model picker, voice input, app connections and approval request: use Chat Composer instead.
- The model menu of an AI chat: use Model Picker instead.
- Send, stop, queue and steer in one control, in twelve styles: use Send control instead.
Installation
Composer is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add composeruse crate::oxyn::{Composer, COMPOSER_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{Composer, COMPOSER_CSS};
Usage
rsx! {
Composer {
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Examples
Chat
Chat app layout with files.
Code
rsx! {
Composer {
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Busy
Working, with a draft to queue.
Code
rsx! {
Composer {
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Desktop
Desktop with context chips and a repo tray.
Code
rsx! {
Composer {
layout: "desktop",
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
attachment_variant: "context-chip",
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Ide panel
IDE side panel, thinking.
Code
rsx! {
Composer {
layout: "ide-panel",
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Terminal
Terminal prompt.
Code
rsx! {
Composer {
layout: "terminal",
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}Offline
Mobile, offline: the draft is kept.
Code
rsx! {
Composer {
layout: "mobile",
agent: agent.state(),
now: clock.now(),
catalog: models(),
model: ModelSelection::Model("ember/swift-2".into()),
usage: Some(context_usage()),
attachments: attachments(),
disabled: Some(DisabledReason::Offline),
on_submit: move |s: Submission| agent.send(s),
on_stop: move |_| agent.stop(),
}
}API reference
Composer
| Prop | Type | Default | Description |
|---|---|---|---|
layout | String | "chat" | `chat` · `ide-panel` · `desktop` · `mobile` · `terminal` · `node`. |
agentrequired | AgentState | — | The agent state. |
nowrequired | ClockMs | — | Shared clock time. |
elapsed | Duration | Default::default() | Elapsed run time (status tab). |
catalogrequired | ModelCatalog | — | The host's model catalogue. |
model | ModelSelection | Default::default() | Initial model. |
favorites | Vec<String> | Default::default() | Favourite model ids. |
recent | Vec<String> | Default::default() | Recent model ids, newest first. |
effort | EffortSetting | Default::default() | Initial effort. |
usage | Option<ContextUsage> | Default::default() | Context usage report. |
attachments | Vec<AttachmentItem> | Default::default() | Attachments (host-owned). |
busy_action | BusyAction | Default::default() | What Enter does while busy. |
disabled | Option<DisabledReason> | Default::default() | Why sending is off. |
text | String | Default::default() | Initial draft text. |
open | String | Default::default() | Popover open at first render (`model`, `effort`, `context`; for demos and tests). |
drop | Option<(String, String)> | Default::default() | Drag state driven by the host (`armed`, `valid`, `invalid`), with its label. |
focused | bool | Default::default() | Draw the focus ring (demos). |
tray | Vec<String> | Default::default() | Repo / branch / env pills under the desktop layout. |
placeholder | Placeholder | Default::default() | Placeholder copy. |
input_variant | Option<String> | Default::default() | Override the layout's input variant. |
attachment_variant | Option<String> | Default::default() | Override the attachment variant. |
model_variant | Option<String> | Default::default() | Override the model picker variant. |
effort_variant | Option<String> | Default::default() | Override the effort variant. |
context_variant | Option<String> | Default::default() | Override the context meter variant. |
send_variant | Option<String> | Default::default() | Override the send control variant. |
error | Option<String> | Default::default() | The last send failed with this reason (send shows ⟲ Retry). |
dictating | bool | Default::default() | Dictation strip open (send shows ✓). |
stop_confirm | Option<String> | Default::default() | Stop confirmation: `double-esc` or `hold` (touch, 400 ms). |
budget | Option<f32> | Default::default() | Time or token budget used, `0..=1` (ring-progress). |
reduced | bool | Default::default() | Reduced motion. |
on_pause | EventHandler<bool> | — | Pause (`true`) or resume (`false`) pressed. |
on_retry | EventHandler<()> | — | Retry pressed. |
on_answer | EventHandler<String> | — | Answer submitted to the pending card. |
on_accept | EventHandler<()> | — | Dictated text accepted. |
on_choose | EventHandler<()> | — | Split ▾ or busy "ask" pressed: the host shows its choices. |
on_submit | EventHandler<Submission> | — | Send pressed or Enter. |
on_stop | EventHandler<()> | — | Stop pressed while busy. |
on_remove | EventHandler<u64> | — | An attachment removed. |
on_files | EventHandler<Vec<(String, u64)>> | — | Files dropped or picked: `(name, bytes)`. |
on_attach | EventHandler<()> | — | The attach button. |
on_compact | EventHandler<()> | — | "Compact now". |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Enter | Send (queue or steer while the agent works) |
| ShiftEnter | New line |
| Esc | Close a popover; otherwise stop the run |
| Alt.orAlt, | Raise / lower effort |
Accessibility
- A multi-line text box labelled "Message the agent"; the placeholder is never the label.
- aria-describedby points at the hint row: keyboard hint, counter and the reason sending is off.
- Busy changes, large pastes and send failures are announced; only send failure is assertive.
From the spec
- The composer is a
formlabelled "Message the agent"; footer controls are atoolbarwith roving tabindex (←/→ between pills, Tab leaves the toolbar). - Focus order: banner action → status strip → queue stack → attachments → input → footer toolbar (tools → mode → permission → model → effort → context → voice) → send.
- One live region per composer (polite) owned by
oxyn-core, so parts don't talk over each other; assertive only for errors, approvals and permission-denied. - Shortcuts are listed in a
?help popover and in each control's description; all are remappable.
Responsive behaviour
- Six layouts: chat, desktop, ide-panel, terminal, mobile and node (canvas).
- Typing still works offline and the draft is kept.
Edge cases (spec)
- Overflow: footer collapse order in §2; layers above the shell share one max height (min(50 % viewport, 360 px)) — queue stack scrolls first, banner never collapses.
- RTL: the whole footer mirrors (send bottom-left); numbers, diff stats and code tokens stay LTR in bidi isolates.
- Tiny / dense:
composer/ide-panelat 280 px shows tools, model (icon), voice, send only. - Touch: every control ≥ 44 px hit area; popovers become sheets on mobile.
- Slow networks / offline: typing, attachments (local), queue and on-device voice keep working; send is disabled with a reason or queues locally (send-control edge cases).
- Fast / slow agents: parts must tolerate
Submitted → Donein one frame and runs of hours (see each part's edge cases). - IME: no part acts on Enter during IME composition.
Notes for AI
- Import
Composerfromoxyn_dioxusand includeCOMPOSER_CSSplus the token stylesheet once. - A GPUI version exists:
ComposerElinoxyn_gpui. - Props to set first:
agent,now,catalog. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.