ClickPowerUp

A bracketed button that arms on hover and powers up with an accent flash and bracket burst on every click.

Preview

Loading GPUI

Props

Install

cargo add evilbuttons

Usage

use evilbuttons::ClickPowerUp;
use gpui::{div, prelude::*, Context, IntoElement, Render, Window};

struct ButtonDemo;

impl Render for ButtonDemo {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        div().child(ClickPowerUp::new("launch", "Launch").on_click(|_, _, _| println!("Powered up")))
    }
}

Variants

Custom accent

Swap the flash color and hold it a little longer.

Loading GPUI
ClickPowerUp::new("overdrive", "Overdrive")
    .accent_color(rgb(0xf59e0b))
    .tap_duration(Duration::from_millis(900))

Props

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

MethodTypeDefaultDescription
new(id, label)impl Into<ElementId>, impl Into<SharedString>-Unique id and the button label (shown uppercase).
tap_duration(d)Duration500msHow long the powered-up flash lasts after a click.
accent_color(c)impl Into<Hsla>#2CD4BDColor of the powered-up flash.
background(c)impl Into<Hsla>theme backgroundFace color. Defaults to shadcn's --background for the window's light or dark appearance.
foreground(c)impl Into<Hsla>theme foregroundInk for the label, brackets, hatching and armed panel.
on_click(f)Fn(&ClickEvent, &mut Window, &mut App)-Fired on every click, and on Space/Enter while focused.
disabled(bool)boolfalseDims the button and ignores input.

Good to know

  • Works in light and dark themes: pass your theme's background and foreground, or let it follow the window appearance.
  • Pressing always wins, so every click, even mid power-up, snaps in then bursts out. Space/Enter press it too.

Search docs

Jump to a button documentation page