ShinyButton

A glossy, gradient-styled button with a layered inner glow and a glint that sweeps across on every click.

Preview

Loading GPUI

Props

Install

cargo add evilbuttons

Usage

use evilbuttons::ShinyButton;
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(ShinyButton::new("launch", "Launch").on_click(|_, _, _| println!("Shiny")))
    }
}

Variants

Slow glint

A longer shine_duration gives a lazier, more luxurious sweep.

Loading GPUI
ShinyButton::new("polish", "Polish").shine_duration(Duration::from_millis(1200))

Props

ShinyButton 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.
shine_duration(d)Duration650msHow long the glint takes to sweep across on click.
on_click(f)Fn(&ClickEvent, &mut Window, &mut App)-Fired before the glint starts.
disabled(bool)boolfalseDims the button and ignores input.

Good to know

  • The skewed glint is painted in thin strips clipped to the rounded rim, so it never spills past the corners.
  • Clicking again mid-sweep restarts the glint.

Search docs

Jump to a button documentation page