Button

Buttons are components that allow users to take actions within your website or app.

Usage

import { Button } from "#/ui/components/Button"
<Button variant="primary">Primary</Button>

Variants

The basic button comes with 5 variants

Size

Each button has 6 different size options to choose between

All of these different sizes are available for each variant

Icons

You can place icons within a button by passing it as a child

If you use an icon without text, make sure to include a hidden label for accessibility purposes

SVG Icons will automatically be resized based on the button size

You can use buttons as links by passing an href prop

Interactivity

While buttons are often used within forms or as links, there are some instances where you may need to use them for something else.

onClick

You can pass an onClick prop to a button to make it interactive, just like you can with a regular HTML button

Customization

Classes

You can customize individual buttons by passing a className prop. If this clashes with the default styles, the className will take precedence.

Due to how tailwind-merge works, you won’t need to worry about conflicting styles when using the className prop.

Make sure you override all the states to ensure a consistent experience, or you’ll end up with something like this