Overview
The Button component is a flexible action element that supports multiple variants, icons, loading states, and animations. Built on top of Radix UI’s Slot component for composition.Import
Usage
Basic Button
With Icon
Loading State
Icon Position
Props
The visual style of the button.Options:
primary, secondary, secondaryOutline, icon, iconButton, sidebar, transparent, tag, filled, light, outline, outlineLight, outlineInput, outlineInputPadding, redOutline, white, success, destructive, backThe size of the button.Options:
sm, md, lgWhen true, renders the button as a Slot component for composition with child elements.
Icon element to display alongside the button text.
Position of the icon relative to the text.Options:
left, centerWhen true, applies hover animation to the icon.
When true, displays a loading spinner and hides the icon.
When true, makes the button take full width.
When true, makes the child wrapper take full width.
Text to display in a tooltip on hover.
When true, disables the button and applies disabled styles.
Additional CSS classes to apply to the button.
Variants
Primary
Secondary
Success
Destructive
Icon Button
Sizes
Examples
With Tooltip
As Link
Brand Icon
Accessibility
- The button automatically sets
aria-labelfrom either thearia-labelprop,descriptiveTooltipText, or text content - When disabled, the button has
disabled:cursor-not-allowedstyling - Loading state is indicated visually with a spinner icon
- Tooltips are accessible via keyboard navigation
Source
View source:packages/ui/src/button/button.tsx