button
Builds Button GradientSpinner PulseLoader Skeleton


The code that drew it
A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.
fn button(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
stack(&theme)
.child(
row(&theme)
.child(
Button::new("scene.button.primary")
.label("Primary")
.primary()
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.secondary")
.label("Secondary")
.secondary()
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.ghost")
.label("Ghost")
.ghost()
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.danger")
.label("Delete")
.danger()
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.link")
.label("Learn more")
.link()
.on_click(|_, _| {}),
),
)
.child(
row(&theme)
.child(
Button::new("scene.button.disabled")
.label("Unavailable")
.primary()
.disabled(true)
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.loading")
.label("Saving")
.primary()
.loading(true)
.on_click(|_, _| {}),
)
.child(
Button::new("scene.button.selected")
.label("Selected")
.secondary()
.selected(true)
.on_click(|_, _| {}),
),
)
.child(
row(&theme)
.child(Button::new("scene.button.xs").label("Extra small").xs())
.child(Button::new("scene.button.sm").label("Small").small())
.child(Button::new("scene.button.md").label("Medium").medium())
.child(Button::new("scene.button.lg").label("Large").large()),
)
.into_any_element()
}