DoubtButton

An escalating-confirmation button that makes you click through increasingly absurd, guilt-tripping prompts before the real action finally fires.

Preview

Loading GPUI

Props

Variants

One quick doubt

Pass a single confirmation for a lightweight "are you sure?" gate.

Loading GPUI
DoubtButton::new("log-out")
    .label("Log out")
    .confirmations(["Sure about that?"])
    .success_label("Bye.")

Maximum dread

A longer chain for the truly irreversible.

Loading GPUI
DoubtButton::new("self-destruct")
    .label("Self destruct")
    .confirmations([
        "Are you sure?",
        "Like, really?",
        "No takebacks.",
        "Think it through.",
        "Final answer?",
        "Going once...",
        "Going twice...",
    ])
    .success_label("Boom.")

Install

cargo add evilbuttons

Usage

use evilbuttons::DoubtButton;

DoubtButton::new("wipe")
    .label("Delete everything")
    .success_label("Too late.")
    .on_confirm(|_, _| wipe_database())

Props

DoubtButton is a GPUI RenderOnce builder; its state is keyed by id.

MethodTypeDefaultDescription
new(id)impl Into<ElementId>-Unique id for the button's state.
label(s)impl Into<SharedString>"Delete everything"Label shown in the idle state.
confirmations(list)IntoIterator<Item: Into<SharedString>>6 escalating promptsPrompts shown one per click; the last one fires the action.
success_label(s)impl Into<SharedString>"Too late."Label flashed after the final confirmation.
on_confirm(f)Fn(&mut Window, &mut App)-Fired only after the last confirmation is clicked.
reset_after(d)Duration1600msHow long to stay in the success state before resetting. Duration::ZERO stays.
disabled(bool)boolfalseDims the button and ignores input.

Good to know

  • Needs confirmations.len() + 1 clicks before on_confirm.
  • An empty confirmations list makes it a normal button.
  • Works from the keyboard too: Space or Enter counts as a click.

Search docs

Jump to a button documentation page