Button
A clickable button widget with multiple visual variants.
Basic Usage
Button("Click me!")
Options
| Option |
Type |
Description |
Example |
Variant |
ButtonVariant |
Sets the visual style of the button |
Variant(Outlined) |
OnClick |
func() |
Sets the click handler callback |
OnClick(func() { fmt.Println("clicked") }) |
ButtonID |
string |
Sets a unique ID for state persistence (use when multiple buttons have the same label) |
ButtonID("submit-btn") |
Button Variants
| Variant |
Description |
Filled |
Solid background with primary color (default) |
Outlined |
Transparent background with border outline |
TextButton |
Transparent background, no border |
Elevated |
Surface variant background with subtle elevation |
Examples
// Filled button (default)
Button("Submit", Variant(Filled))
// Outlined button
Button("Cancel", Variant(Outlined))
// Text button
Button("Learn More", Variant(TextButton))
// Elevated button
Button("Action", Variant(Elevated))
// Button with click handler
Button("Save", OnClick(func() {
fmt.Println("Saved!")
}))
// Multiple buttons with same label need unique IDs
Button("Delete", ButtonID("delete-item-1"))
Button("Delete", ButtonID("delete-item-2"))