Button
Displays a button or a component that looks like a button.
Installation
The Button component is part of Slate UI Kit and is available by default.
Usage
Variants
Use the variant prop to change the visual style of the button.
Sizes
Use the size prop to change the size of the button.
With Icons
Add icons to your buttons using the icon prop.
Loading State
Use the loading prop to show a loading state.
Disabled State
Disable a button by adding the disabled attribute.
API Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant |
string |
"default" |
The visual style variant. Options: default, success, warning, error, danger, outline, secondary, ghost, link |
size |
string |
"default" |
The size of the button. Options: sm, default, lg |
color |
string |
null |
Override the default color. Options: primary, secondary, success, warning, info, error, danger |
type |
string |
"button" |
The HTML button type. Options: button, submit, reset |
loading |
boolean |
false |
Show loading state |
loadingText |
string |
null |
Custom text to show when loading |
showSpinner |
boolean |
true |
Show spinner when loading |
icon |
string |
null |
Icon name (Carbon icon) |
iconPosition |
string |
"left" |
Position of the icon. Options: left, right |
Variants
- default - Primary button style
- success - Success state (green)
- warning - Warning state (yellow/orange)
- error - Error state (red)
- danger - Danger/destructive state (darker red)
- outline - Outlined button
- secondary - Secondary button style
- ghost - Ghost/transparent button
- link - Link-style button
Sizes
- sm - Small button (height: 36px)
- default - Default button (height: 40px)
- lg - Large button (height: 44px)
Accessibility
The Button component includes:
- Proper ARIA attributes
- Keyboard navigation support
- Focus visible states
- Disabled state handling