Skip to content
Back

Confirm popover

A destructive button that grows into a small card: the consequence, an optional type-to-confirm phrase that fills Delete as you type, progress on the button, then a check in the button's shape or the error with Try again.

oxyn add confirm-popover
MCP
Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Dioxus
let mut p = use_signal(ConfirmPopover::new);
p.write().confirm_text = Some("acme-web".into()); // type to confirm

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • A destructive button that grows into a small confirmation card: the consequence in one or two sentences, an optional type-to-confirm phrase (case and outer spaces ignored) that fills Confirm as the typed prefix matches, progress on the Confirm button (reported or an indeterminate sweep), then a check in the button's shape, or the failure with the rejection message and Try again.

When not to use

  • An agent asks before it acts: use Approval Card instead.
  • Several open requests in one card: use Approval pager instead.
  • An agent's question in its own card above the composer: use Decision Card instead.

Installation

Confirm popover 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 confirm-popover
Rust
use crate::oxyn::{ConfirmPopover, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ConfirmPopover, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
let mut p = use_signal(ConfirmPopover::new);
p.write().confirm_text = Some("acme-web".into()); // type to confirm

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Examples

Phrase

Type the project name to unlock Delete.

Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Code
let mut p = use_signal(ConfirmPopover::new);
p.write().confirm_text = Some("acme-web".into()); // type to confirm

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Plain

Consequence and two buttons.

Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Code
let mut p = use_signal(ConfirmPopover::new);

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Neutral

Reversible: foreground fill.

Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Code
let mut p = use_signal(ConfirmPopover::new);

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Error

Fails: the message and Try again.

Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Code
let mut p = use_signal(ConfirmPopover::new);

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

Sweep

No progress reported: an indeterminate sweep.

Delete this project?
This removes the acme-web project, its 14 deployments and its domains. It can't be undone.
Code
let mut p = use_signal(ConfirmPopover::new);

rsx! {
    ConfirmPopover {
        model: p(),
        now: clock.now(),
        description: "This removes the acme-web project…",
        on_submit: move |_| if p.write().submit(now) { spawn(delete(p)) },
        on_type: move |s| p.write().type_text(&s),
    }
}

API reference

ConfirmPopover

PropTypeDefaultDescription
modelrequiredPopModel—Model.
nowrequiredClockMs—Shared clock.
labelString"Delete project"Trigger label.
titleString"Delete this project?"Card heading.
descriptionOption<String>Default::default()The consequence (describes the dialog).
iconString"trash"Trigger icon.
confirm_labelString"Delete"Confirm label.
cancel_labelString"Cancel"Cancel label.
pending_labelString"Deleting"Progress label.
success_labelString"Deleted"Success label (no longer than the trigger label).
error_titleString"That didn't work"Failure heading.
retry_labelString"Try again"Retry label.
on_showEventHandler<()>—Trigger pressed.
on_dismissEventHandler<()>—Cancel or Escape.
on_typeEventHandler<String>—Phrase typed.
on_submitEventHandler<()>—Confirm pressed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterConfirm (shakes when the phrase does not match)
EscapeDismiss
TabPhrase field, Cancel, Delete

Accessibility

  • The card is an alertdialog named by its heading and described by the consequence.
  • The trigger has aria-expanded; Delete is aria-disabled until the phrase matches (case and outer spaces ignored).
From the spec
  • Trigger: aria-expanded + aria-haspopup=dialog.
  • Card: role=alertdialog named by its heading, described by the consequence.
  • Delete is aria-disabled until unlocked; the phrase field gets aria-invalid when it stops matching.

Motion & interaction

Timing
  • Card grows from the kept edge (scale .94 → 1, 200 ms).
  • Wrong submit: 320 ms damped shake (6 px).
  • Reduced motion: no grow, no shake (the field is marked invalid instead).

Responsive behaviour

  • 300 px card, max 100 %; `end` keeps the right edge for buttons at the end of a row.
Edge cases (spec)
  • 300 px card, max 100 %; align start / center / end.

Notes for AI

  • Import ConfirmPopover from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ConfirmPopoverEl in oxyn_gpui.
  • Props to set first: model, 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.

Guides

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