Skip to content
Back

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 composer
MCP
PNG
64%
PDF
RS
CSV
Waiting for 1 upload
Dioxus
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(),
    }
}

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.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add composer
Rust
use 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

Dioxus · rust
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.

PNG
64%
PDF
RS
CSV
Waiting for 1 upload
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.

Running cargo test·0:42
Enter to queue · ⌘↵ to steer
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.

auth.rssrc/middleware
main3 changes
token.rslines 12–40
docs.rs
oxynfeat/site-v1Local
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.

Thinking·0:42
login-flow.png64 %
spec.pdfPDF · 12 pages
auth.rsRS · 18 KB
q3-revenue.csvUpload failed
Enter to queue · ⌘↵ to steer
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.

›
·
·⏎ send · ⇧⏎ newline · ⌥. effort
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.

PNG
64%
PDF
RS
CSV
You're offline · your draft is saved
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

PropTypeDefaultDescription
layoutString"chat"`chat` · `ide-panel` · `desktop` · `mobile` · `terminal` · `node`.
agentrequiredAgentState—The agent state.
nowrequiredClockMs—Shared clock time.
elapsedDurationDefault::default()Elapsed run time (status tab).
catalogrequiredModelCatalog—The host's model catalogue.
modelModelSelectionDefault::default()Initial model.
favoritesVec<String>Default::default()Favourite model ids.
recentVec<String>Default::default()Recent model ids, newest first.
effortEffortSettingDefault::default()Initial effort.
usageOption<ContextUsage>Default::default()Context usage report.
attachmentsVec<AttachmentItem>Default::default()Attachments (host-owned).
busy_actionBusyActionDefault::default()What Enter does while busy.
disabledOption<DisabledReason>Default::default()Why sending is off.
textStringDefault::default()Initial draft text.
openStringDefault::default()Popover open at first render (`model`, `effort`, `context`; for demos and tests).
dropOption<(String, String)>Default::default()Drag state driven by the host (`armed`, `valid`, `invalid`), with its label.
focusedboolDefault::default()Draw the focus ring (demos).
trayVec<String>Default::default()Repo / branch / env pills under the desktop layout.
placeholderPlaceholderDefault::default()Placeholder copy.
input_variantOption<String>Default::default()Override the layout's input variant.
attachment_variantOption<String>Default::default()Override the attachment variant.
model_variantOption<String>Default::default()Override the model picker variant.
effort_variantOption<String>Default::default()Override the effort variant.
context_variantOption<String>Default::default()Override the context meter variant.
send_variantOption<String>Default::default()Override the send control variant.
errorOption<String>Default::default()The last send failed with this reason (send shows ⟲ Retry).
dictatingboolDefault::default()Dictation strip open (send shows ✓).
stop_confirmOption<String>Default::default()Stop confirmation: `double-esc` or `hold` (touch, 400 ms).
budgetOption<f32>Default::default()Time or token budget used, `0..=1` (ring-progress).
reducedboolDefault::default()Reduced motion.
on_pauseEventHandler<bool>—Pause (`true`) or resume (`false`) pressed.
on_retryEventHandler<()>—Retry pressed.
on_answerEventHandler<String>—Answer submitted to the pending card.
on_acceptEventHandler<()>—Dictated text accepted.
on_chooseEventHandler<()>—Split ▾ or busy "ask" pressed: the host shows its choices.
on_submitEventHandler<Submission>—Send pressed or Enter.
on_stopEventHandler<()>—Stop pressed while busy.
on_removeEventHandler<u64>—An attachment removed.
on_filesEventHandler<Vec<(String, u64)>>—Files dropped or picked: `(name, bytes)`.
on_attachEventHandler<()>—The attach button.
on_compactEventHandler<()>—"Compact now".

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterSend (queue or steer while the agent works)
ShiftEnterNew line
EscClose 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 form labelled "Message the agent"; footer controls are a toolbar with 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-panel at 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 → Done in 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 Composer from oxyn_dioxus and include COMPOSER_CSS plus the token stylesheet once.
  • A GPUI version exists: ComposerEl in oxyn_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.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI