Button

Form

Beautifully styled buttons with multiple variants and sizes.

Preview

Variants

Primary
Secondary
Outline
Ghost
Destructive
Link

Usage

button.rs
use floe_ui::components::button::{self, ButtonSize};

"text-zinc-500">// Primary (default) button
let btn = button::primary("Click me", &tokens)
    .on_press(Message::Clicked);

"text-zinc-500">// Secondary button
let btn2 = button::secondary("Cancel", &tokens)
    .on_press(Message::Cancel);

"text-zinc-500">// Outline button
let btn3 = button::outline("Details", &tokens)
    .on_press(Message::Details);

"text-zinc-500">// Ghost button
let btn4 = button::ghost("More", &tokens)
    .on_press(Message::More);

"text-zinc-500">// Destructive button
let btn5 = button::destructive("Delete", &tokens)
    .on_press(Message::Delete);

"text-zinc-500">// Link button
let btn6 = button::link("Learn more", &tokens)
    .on_press(Message::LearnMore);

"text-zinc-500">// Custom size
let btn_lg = button::primary_sized("Large", &tokens, ButtonSize::Lg)
    .on_press(Message::Clicked);

API Reference

Props / Parameters

NameTypeDescription
label&strButton text content
tokens&DesignTokensDesign tokens for theming
sizeButtonSizeSize preset: Sm, Default, Lg, Icon

Style Functions

primary_style(tokens)
secondary_style(tokens)
outline_style(tokens)
ghost_style(tokens)
destructive_style(tokens)
link_style(tokens)

Style functions return closures compatible with Iced's .style() method.

Builder Functions

primary(label, tokens)
secondary(label, tokens)
outline(label, tokens)
ghost(label, tokens)
destructive(label, tokens)
link(label, tokens)
primary_sized(label, tokens, size)

Builder functions return pre-configured Iced widgets ready for use.

Source: floe-ui/src/components/button.rs