Updated: We have updated the button component to add new sizes:
icon-sm and icon-lg. See the changelog for more details.Installation
- CLI
- Manual
Usage
Examples
Size
Default
Outline
Secondary
Ghost
Destructive
Link
Icon
With Icon
The spacing between the icon and the text is automatically adjusted based on the size of the button. You do not need any margin on the icon.Rounded
Use therounded-full class to make the button rounded.
Spinner
Button Group
To create a button group, use theButtonGroup component. See the Button Group documentation for more details.
Link
You can convert the<button> into an <a> element by simply passing an href as a prop.
buttonVariants helper to create a link that looks like a button.
Changelog
2025-09-24 New sizes
We have added two new sizes to the button component:icon-sm and icon-lg. These sizes are used to create icon buttons. To add them, edit button.svelte and add the following code under size in buttonVariants:
components/ui/button.svelte