Skip to main content
Updated: We have updated the button component to add new sizes: icon-sm and icon-lg. See the changelog for more details.

Installation

Usage

Examples

Size

Default

Outline

Secondary

Ghost

Destructive

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 the rounded-full class to make the button rounded.

Spinner

Button Group

To create a button group, use the ButtonGroup component. See the Button Group documentation for more details. You can convert the <button> into an <a> element by simply passing an href as a prop.
Alternatively, you can use the 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