Button
A clickable button that triggers a function when pressed. Buttons are the primary way users interact with your widget, whether submitting forms, navigating between views, or performing actions.Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Button text. |
onClickAction | action | — | Function to run when clicked. |
variant | solid | soft | outline | ghost | solid | Visual style of the button. |
color | primary | secondary | success | danger | warning | info | discovery | caution | secondary | Button color. |
size | 3xs | 2xs | xs | sm | md | lg | xl | 2xl | 3xl | md | Button size. |
iconStart | icon name | — | Icon displayed before the label. |
iconEnd | icon name | — | Icon displayed after the label. |
iconSize | sm | md | lg | xl | 2xl | — | Size of the start and end icons. |
submit | boolean | false | Submit the parent form when clicked. |
block | boolean | false | Stretch the button to full width. |
pill | boolean | false | Apply fully rounded corners. |
uniform | boolean | false | Equal width and height, creating a square button. |
disabled | boolean | false | Disable the button, preventing interaction. |
Examples
Basic Action Button
A simple button that triggers a named function when clicked.Form Submit Button
Use thesubmit prop to make the button submit its parent form. Pair this with a Card that has asForm set to true.
When
submit is true, clicking the button collects all input values from the parent form and passes them to the function defined in the Card’s confirm action or the button’s own onClickAction.Icon Button
Add icons before or after the label usingiconStart and iconEnd. Use the uniform prop to create a square icon-only button.
Full-Width Button
Setblock to true to make the button span the entire width of its container.
Button with Additional Inputs
Pass extra data alongside the action usingadditionalInputs. This is especially useful when rendering buttons in a loop, where each button needs to reference a specific item.