Preview
Loading GPUI
Props
Install
cargo add evilbuttonsUsage
use evilbuttons::MinimalButton;
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(MinimalButton::new("browse", "Browse components"))
}
}Variants
No arrow
Loading GPUI
MinimalButton::new("save", "Save draft").arrow(false)Props
MinimalButton is a GPUI RenderOnce builder; its animation state is keyed by id.
| Method | Type | Default | Description |
|---|---|---|---|
new(id, label) | impl Into<ElementId>, impl Into<SharedString> | - | Unique id and the button label. |
arrow(bool) | bool | true | Show a trailing chevron that nudges forward on hover. |
on_click(f) | Fn(&ClickEvent, &mut Window, &mut App) | - | Fired on click, and on Space/Enter while focused. |
disabled(bool) | bool | false | Dims the button and ignores input. |
Good to know
- GPUI has no CSS transforms, so the 97% press is painted: the surface and its shadows shrink around their centre.
- Stays dark in both themes.