Skip to content
Back

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-composer
MCP
Dioxus
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),
    }
}

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.

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

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

Draft a short update for the team about this week's progress
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.

Q3 board report.pdfPDF
screenshot.pngImage
Launch budget.xlsxSpreadsheet
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.

How should actions be approved?Learn more
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

PropTypeDefaultDescription
placeholderString"Start by typing…"Placeholder.
textStringDefault::default()Starting text.
modelsVec<String>default_models()Model names; the first is selected (Auto draws a sparkle, known brands their mark).
dictationString"Draft a short update for the team about this week's progress"Demo transcript that arrives word by word while recording.
approvalString"ask"Starting approval mode: `ask`, `auto` or `full`.
foldersVec<String>default_folders()Folders in "Work in a folder"; empty leaves the picker out.
folderOption<String>Default::default()Starting folder.
appsVec<(String, String)>default_apps()Apps (id, name) in "Connect apps"; the first three show their marks.
connectedVec<String>vec!["gmail".to_string()]Connected app ids at the start.
traybooltrueThe tray under the card (folder and apps). Off once a chat has started: the apps move into the plus menu.
styleStringDefault::default()`clean`, `classic`, or empty to follow `data-cstyle`.
attachmentsVec<String>Default::default()Attachment kinds to start with (`pdf`, `image`, …).
recordingboolDefault::default()Start in recording mode (the words already arriving).
default_openOption<String>Default::default()A menu open from the start: `plus`, `approval`, `model`, `folder` or `apps`.
nowrequiredClockMs—Shared clock (recording trace and words).
on_sendEventHandler<(String, String)>—Sent: text and model.
on_model_changeEventHandler<String>—Model picked.
on_attachEventHandler<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_changeEventHandler<String>—Approval mode picked.
on_folder_changeEventHandler<Option<String>>—Folder picked (`None` when the picked folder is picked again).
on_apps_changeEventHandler<Vec<String>>—Connected app ids.

FileTypeIcon

PropTypeDefaultDescription
kindrequiredString—`pdf`, `image`, `sheet`, `doc`, `code` or `folder`.
sizef3220.0Size px.
plainboolDefault::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

KeyAction
EnterSend
ShiftEnterNew line
EnterorSpaceor↓Open the menu of the focused button (plus, approval, model, folder, apps)
EscClose the menu, or discard a recording
TabMove 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 is menuitemcheckbox), approval / model / folder = listbox, apps = menuitemcheckbox; every button carries aria-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-size on a 540 px root (max-width: 100%); the approval menu is min(352px, 100cqi - 40px); labels ellipsize before the row wraps.

Notes for AI

  • Import ChatComposer, FileTypeIcon from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ChatComposerEl in oxyn_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.

Guides

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