Preview
Loading GPUI
Props
Custom Variant
You can easily override the default colors to create your own flavor of neobrutalism.
Loading GPUI
BrutalButton::new("brutal", "Brutal Doom")
.color(rgb(0xa3e635))
.text_color(rgb(0x000000))
.radius(12.0)Install
cargo add evilbuttonsUsage
use evilbuttons::BrutalButton;
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(BrutalButton::new("launch", "Launch"))
}
}Props
| Method | Type | Default | Description |
|---|---|---|---|
new(id, label) | impl Into<ElementId>, impl Into<SharedString> | - | Unique id and the button label. |
color(c) | impl Into<Hsla> | #ffffff | Background color of the button. |
text_color(c) | impl Into<Hsla> | #0a0a0a | Text color of the button. |
border(c) | Option<Hsla> | Some(#0a0a0a) | Color of the 2px border; None removes it. |
shadow(c) | Option<Hsla> | Some(#0a0a0a) | Color of the sharp shadow; None removes it and the press squashes instead. |
radius(px) | f32 | 0.0 | Corner radius. |
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. |