iced-cube

Actions

Button

Triggers an action, with consistent variants, sizes and states.

use iced_cube::{button, lucide};
use iced_cube::primitives::button::{Size, Variant};
API reference
Variants: Every visual variant, from primary to link.Variants: Every visual variant, from primary to link.
Static preview
Variants. Every visual variant, from primary to link.

Usage

Use one primary button per view for the main action, and secondary, outline or ghost buttons for everything else. Destructive buttons are for actions that delete or cannot be undone.

For a button that shows only an icon, such as a toolbar toggle or a close button, use Icon Button.

Icons come from Lucide through the lucide! macro, which resolves the icon at compile time so only the icons you use are included in your binary.

Examples

Sizes

Small, medium and large, plus the square icon size.

Sizes: Small, medium and large, plus the square icon size.Sizes: Small, medium and large, plus the square icon size.
Static preview

With icon

Lucide icons before or after the label.

With icon: Lucide icons before or after the label.With icon: Lucide icons before or after the label.
Static preview

Enabled and disabled

A button without a message renders disabled.

Enabled and disabled: A button without a message renders disabled.Enabled and disabled: A button without a message renders disabled.
Static preview

API

ItemDescription
button(label)Creates a text button. It renders disabled until it has a message.
.variant(Variant)Primary, Secondary, Destructive, Outline, Ghost or Link. Defaults to Primary. Link has no side padding, so it lines up with nearby text.
.size(Size)Sm, Md or Lg. Defaults to Md. The square Icon size is deprecated; use icon_button instead.
.icon(glyph) / .trailing_icon(glyph)Adds a Lucide icon before or after the label.
.on_press(message) / .on_press_maybe(option)Sets the message emitted on press. None disables the button.
.width(length)Overrides the width. Buttons shrink to fit by default.
Esc