Chat Composer
Prompt composer with model picker, voice input, app connections and approval request: a scrolling plus menu with Plugins, the orange Unrestricted access chip, recording with a dotted level meter, and a tray with a folder picker and Connect apps.
oxyn add chat-composerrsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Rendered from Rust at build time · goes live when visible
When to use
- The main input of an assistant or agent that acts on connected tools.
- A large message field ("Start by typing…"); a row with +, the approval chip, the Auto model menu, the mic and a send button; and under the card a grey tray with "Work in a folder" (left) and "Connect apps" with the first three app marks (right).
- Turn the tray off once a chat has started: the apps move into the plus menu.
When not to use
- The model menu of an AI chat: use Model Picker instead.
- The prompt box for an agent, in six layouts: use Composer instead.
- Send, stop, queue and steer in one control, in twelve styles: use Send control instead.
Installation
Chat 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 chat-composeruse crate::oxyn::{ChatComposer, FileTypeIcon, STATUS_INDICATOR_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ChatComposer, FileTypeIcon, STATUS_INDICATOR_CSS};
Usage
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Examples
Default
Clean: one continuous container with the tray under a hairline; type, pick approval and model, dictate, connect apps.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Classic
Classic style: the writing card inset on a darker band, the tray on the band.
Code
rsx! {
ChatComposer {
now: clock.now(),
style: "classic".into(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Unrestricted
Full access picked: the orange Unrestricted access chip.
Code
rsx! {
ChatComposer {
now: clock.now(),
approval: "full".into(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Recording
Recording: sixteen blue capsules resting as dots and rising with the voice, words arriving in grey, ✕ discards and ✓ keeps them.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Attachments
Oxyn extra: attachment chips (PDF, image thumbnail, spreadsheet) above the field.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Plus menu
The plus menu: a capped, scrolling list – Files and folders, Attach Claude, Work in a folder, Goal, Plan mode, Record a skill, Draw, then Plugins: Documents, PDF.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Models
The model menu with coloured brand marks, capped at six rows with a thin scroll.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Approvals menu
How should actions be approved? Request approval, Approve for me, Full access.
Code
rsx! {
ChatComposer {
now: clock.now(),
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}In chat
Once a chat has started: no tray, the apps move into the plus menu.
Code
rsx! {
ChatComposer {
now: clock.now(),
tray: false,
on_send: move |(text, model)| send(text, model),
on_attach: move |kind| open_picker(kind),
on_apps_change: move |ids| save_connections(ids),
}
}Oxyn ai composer
Extended: the AI composer with / commands and @ mentions.
What should we work on?
Code
rsx! {
AiComposer {
now: clock.now(),
}
}API reference
ChatComposer
| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | String | "Start by typing…" | Placeholder. |
text | String | Default::default() | Starting text. |
models | Vec<String> | default_models() | Model names; the first is selected (Auto draws a sparkle, known brands their mark). |
dictation | String | "Draft a short update for the team about this week's progress" | Demo transcript that arrives word by word while recording. |
approval | String | "ask" | Starting approval mode: `ask`, `auto` or `full`. |
folders | Vec<String> | default_folders() | Folders in "Work in a folder"; empty leaves the picker out. |
folder | Option<String> | Default::default() | Starting folder. |
apps | Vec<(String, String)> | default_apps() | Apps (id, name) in "Connect apps"; the first three show their marks. |
connected | Vec<String> | vec!["gmail".to_string()] | Connected app ids at the start. |
tray | bool | true | The tray under the card (folder and apps). Off once a chat has started: the apps move into the plus menu. |
style | String | Default::default() | `clean`, `classic`, or empty to follow `data-cstyle`. |
attachments | Vec<String> | Default::default() | Attachment kinds to start with (`pdf`, `image`, …). |
recording | bool | Default::default() | Start in recording mode (the words already arriving). |
default_open | Option<String> | Default::default() | A menu open from the start: `plus`, `approval`, `model`, `folder` or `apps`. |
nowrequired | ClockMs | — | Shared clock (recording trace and words). |
on_send | EventHandler<(String, String)> | — | Sent: text and model. |
on_model_change | EventHandler<String> | — | Model picked. |
on_attach | EventHandler<String> | — | Plus menu entry picked: `files`, `claude`, `folder` (also opens the folder picker), `goal`, `plan` (toggles plan mode), `skill`, `draw`, `documents` or `pdf`. |
on_approval_change | EventHandler<String> | — | Approval mode picked. |
on_folder_change | EventHandler<Option<String>> | — | Folder picked (`None` when the picked folder is picked again). |
on_apps_change | EventHandler<Vec<String>> | — | Connected app ids. |
FileTypeIcon
| Prop | Type | Default | Description |
|---|---|---|---|
kindrequired | String | — | `pdf`, `image`, `sheet`, `doc`, `code` or `folder`. |
size | f32 | 20.0 | Size px. |
plain | bool | Default::default() | Text lines on the page instead of the badge (the plugin marks in the plus menu). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Enter | Send |
| ShiftEnter | New line |
| EnterorSpaceor↓ | Open the menu of the focused button (plus, approval, model, folder, apps) |
| Esc | Close the menu, or discard a recording |
| Tab | Move on (closes nothing silently: menus close on pick or Esc) |
Accessibility
- Plus is a menu (Plan mode a menuitemcheckbox); approval, model and folder are listboxes; apps are menuitemcheckboxes; every trigger carries aria-expanded.
- A polite live region announces modes, models, attachments, recording and sends.
- Clicking anywhere on the card focuses the field.
From the spec
- Plus =
menu(Plan mode ismenuitemcheckbox), approval / model / folder =listbox, apps =menuitemcheckbox; every button carriesaria-expanded. - A polite live region announces modes, models, folders, apps, "Recording. Press Escape to discard.", "Recording added to your message." and "Message sent."
- Long folder names ellipsize with the full name in a tooltip. A closed menu leaves the layout.
Motion & interaction
Timing
- Menus morph out of the corner next to their button (scale + fade, 170 ms,
cubic-bezier(.2,.8,.2,1)), opening toward the side with more room; the plus menu spans the composer. - Approval chip morphs width between modes (320 ms); the hand waves on hover.
- Recording: meter frames every 110 ms (bars ease 110 ms); words every 190 ms; ✕ / ✓ pop in (220 ms).
- Attachment chips pop in (240 ms); check marks draw in (300 ms).
- Reduced motion: no scale, wave or pop; colour changes only.
Responsive behaviour
- Fills its container up to 680 px; under 460 px the plus menu drops its hints; under 380 px the approval chip shows its icon only.
Edge cases (spec)
container-type: inline-sizeon a 540 px root (max-width: 100%); the approval menu ismin(352px, 100cqi - 40px); labels ellipsize before the row wraps.
Notes for AI
- Import
ChatComposer,FileTypeIconfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
ChatComposerElinoxyn_gpui. - Props to set first:
now,kind. - 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.