AI composerPro
The prompt box of an AI app: / commands and @ mentions as atomic tokens, a model and effort menu, a ring counter near the limit, and a send button that turns into a stop control ringed by the reply's progress.
oxyn add ai-composerWhat should we work on?
The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- The prompt box of an AI app. / at a line start opens commands (/summarize, /translate, /explain, /fix); @ after a space or at the start opens files and docs (trigger, filter).
- Arrow keys move through the open list while the field keeps focus; Enter or Tab inserts the choice as one atomic token, and Backspace on an empty field removes the last token whole (text before it becomes editable again).
- Starters under the composer fill it (a known command at the start becomes a token).
- The toolbar holds the model chip with an effort control and a Web search toggle.
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.
- The prompt box for an agent, in six layouts: use Composer instead.
Installation
AI composer is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add ai-composerUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Default
Type / or @; send to see the stop ring.
What should we work on?
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Limit
A low limit shows the ring counter.
What should we work on?
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Bare
No suggestions.
What should we work on?
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
AiComposer
| Prop | Type | Default | Description |
|---|---|---|---|
greeting | String | "What should we work on?" | Heading of the new chat state. |
suggestions | Vec<(String, String)> | Default::default() | Starters under the composer: label and prompt. |
models | Vec<(String, String, String)> | Default::default() | Models: id, short name, note. |
mentions | Vec<String> | Default::default() | Files and docs for `@`. |
placeholder | String | "Ask anything, / for commands, @ to add context" | Placeholder. |
max_length | usize | 4000 | Character limit. |
text | String | Default::default() | Starting text. |
reply | String | "Here's a plan: add a token bucket per API key in the gateway, return 429 with Retry-After when it empties, and cover it with two integration tests. I'll start with the middleware." | The reply the demo streams back. |
nowrequired | ClockMs | — | Shared clock (streaming). |
on_send | EventHandler<(String, String)> | — | Sent: plain text with tokens written as /cmd and @name, and the model id. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Enter | Send, or insert the highlighted option |
| ShiftEnter | New line |
| / | Commands at a line start |
| @ | Files and docs |
| ↑or↓ | Move through the open list |
| Tab | Insert the option |
| Escape | Close the list |
| Backspace | Remove a token whole |
Accessibility
- The field controls the list through aria-activedescendant.
- Send flips its label to Stop while streaming.
From the spec
- The field references the list with aria-activedescendant; Send becomes Stop while streaming.
Motion & interaction
Timing
- Arrow lift and stop pop 220 ms; reply chunks every 34 ms; ring 200 ms.
- Reduced motion stops the shimmer and caret blink.
Responsive behaviour
- Fills its container up to 560 px.
Edge cases (spec)
- Up to 560 px.
Notes for AI
- Import
AiComposerfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
AiComposerElinoxyn_gpui. - Props to set first:
now. - 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.