Dialog
A modal window on a dimmed backdrop: title and quiet line, a body that scrolls under a fixed header and footer, Escape and backdrop close, focus kept inside and handed back.
oxyn add dialogrsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Rendered from Rust at build time · goes live when visible
When to use
- A focused task or a confirmation the user must answer before going back to the page: editing an agent's permissions, renaming a project, confirming that a run, a worktree or a whole project should be deleted.
- The rest of the app dims and waits.
When not to use
- The dialog docked to an edge for inspectors and run details: use Sheet instead.
- Nested sheets with depth: use Sheet stack instead.
- A sheet that rests at a peek or full height and follows your finger: use Bottom sheet instead.
Installation
Dialog 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 dialoguse crate::oxyn::{Dialog, PRIMITIVES_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{Dialog, PRIMITIVES_CSS};
Usage
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Examples
Form
Settings with a Save footer.
Code
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Confirm danger
An alert dialog with a red confirm that runs before closing.
Code
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
size: "sm",
tone: "danger",
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Sticky
Backdrop and Escape don't close it.
Code
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
close_on_backdrop: false,
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Floating
Non-modal: the page stays live behind it.
Code
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
modal: false,
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}Closed
Just the trigger.
Code
rsx! {
Dialog {
title: "Agent permissions",
description: "Applies to new runs in Atlas",
trigger_label: "Permissions",
confirm_label: "Save",
busy_ms: 1200,
on_confirm: move |_| save(),
}
}API reference
Dialog
| Prop | Type | Default | Description |
|---|---|---|---|
titlerequired | String | — | Title (names the dialog). |
description | Option<String> | Default::default() | Quiet line (describes it). |
open | bool | Default::default() | Start open. |
trigger_label | Option<String> | Default::default() | A secondary button that opens it. |
size | String | "md" | `sm` · `md` · `lg` · `full`. |
width | Option<f32> | Default::default() | Width px (overrides size). |
close_on_backdrop | bool | true | A press on the backdrop closes it. |
close_on_escape | bool | true | Escape closes it. |
close_button | bool | true | The × button. |
close_label | String | "Close" | Its label. |
contained | bool | Default::default() | Inside the nearest positioned ancestor instead of the viewport. |
modal | bool | true | Modal (traps focus, dims the page). Off = floating card. |
tone | String | "default" | `default` · `danger` (an alert dialog with a red confirm). |
confirm_label | Option<String> | Default::default() | Footer confirm label (adds Cancel + Confirm). |
cancel_label | String | "Cancel" | Cancel label. |
busy_ms | u32 | Default::default() | Oxyn plus: the confirm runs this long (spinner, can't dismiss). |
children | Element | Default::default() | Body. |
on_open_change | EventHandler<bool> | — | Open state changed. |
on_confirm | EventHandler<()> | — | Confirm finished. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Esc | Close and return focus to the trigger |
| TaborShiftTab | Cycle focus inside |
| Enter | Run the focused button |
Accessibility
- role=dialog (alertdialog when danger) with aria-modal, named by the title and described by the quiet line.
- Focus moves into the dialog and wraps at both ends; closing hands it back to the trigger.
- While a confirm runs the dialog is aria-busy and can't be dismissed.
From the spec
Focus moves into the panel on open and wraps at both ends with sentinel guards; on close it returns to the trigger. The title names the dialog and the quiet line describes it. Danger dialogs are alertdialog. The close button is labelled (close_label, default "Close").
Motion & interaction
The scrim fades in with a 3 px backdrop blur. The panel rises 8 px from 0.96 scale; the title rises out of a 3 px blur. Exit is quicker than enter. The close button tints on hover; the confirm spinner sits before its label so the width barely moves.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Scrim in | 200 ms | ease.out | 120 ms fade |
| Panel in | 240 ms, 8 px, 0.96 → 1 | ease.out | 120 ms fade |
| Panel out | 160 ms, to 0.98 | ease.out | instant |
| Busy confirm | busy_ms (default 0) | linear timer | same |
Responsive behaviour
- min(viewport − 32 px, size) wide and capped at the viewport height; the body scrolls.
Edge cases (spec)
Long titles wrap; long bodies scroll under the fixed header and footer. On a phone the panel is viewport − 32 px wide and full fills the viewport with a 16 px margin. Dialogs opened from a menu restore focus to the menu's trigger. A run finishing while the confirm is busy is the host's to reconcile.
Notes for AI
- Import
Dialogfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
DialogElinoxyn_gpui. - Props to set first:
title. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.