Overview
Thebutton widget creates a focusable, pressable button with customizable styling and event handling. Buttons automatically integrate with Rezi’s design system when semantic theme tokens are available.
Basic Usage
Props
Unique identifier for focus routing. Required for all buttons.
Button text to display.
Callback invoked when the button is activated (Space, Enter, or mouse click).
When true, button cannot be focused or pressed.
When false, opt out of Tab focus order while keeping id-based routing available.
Optional semantic label for accessibility and debug announcements.
Styling Props
Shorthand for
dsVariant + dsTone + dsSize. Maps to design system presets:"primary"→ solid + primary (main CTA)"secondary"→ soft + default (secondary actions)"danger"→ outline + danger (destructive actions)"success"→ soft + success (positive confirmations)"warning"→ soft + warning (caution actions)"link"→ ghost + default + sm (minimal link-style)
Design system visual variant:
"solid"- Accent background, inverse text (primary CTA)"soft"- Subtle background, accent text (secondary)"outline"- Border, no fill (tertiary)"ghost"- No background or border (minimal)
Design system color tone:
"default", "primary", "success", "warning", "danger".Design system size preset:
"xs", "sm", "md", "lg", "xl".Horizontal padding in cells. When using design system recipes, overrides the padding derived from
dsSize.
Legacy/manual rendering default: 1.Optional style applied to the button label (merged with focus/disabled state).
Optional style applied while the button is pressed.
Optional focus appearance configuration for custom focus indicators.
Event Handling
Buttons emit press events through theonPress callback:
Design System Integration
Intent Shortcuts
Use theintent prop for common button styles:
Manual Design System Props
For fine-grained control, usedsVariant, dsTone, and dsSize directly:
Theme Fallback
If the active theme does not provide semantic color tokens, buttons fall back to non-recipe rendering using thestyle prop.
Form Integration
Buttons are commonly used in forms with theui.actions() helper:
Validation States
Disable buttons during validation or loading:Button Groups
Create aligned button groups withui.actions() or ui.row():
Examples
Confirm Dialog
Loading Button
Toolbar Buttons
Accessibility
- Buttons require a unique
idfor focus routing - Use
accessibleLabelfor descriptive announcements - Disabled buttons are not focusable or pressable
- Focus indicators are shown when navigating with keyboard