Skip to main content

Button

Button is an interactive button component with variants, sizes, color schemes, and loading states.

Open in Storybook

Import

import { Button } from "@tosui/react";

Basic Usage

Variants

Use variant to change the visual weight of the action.

Sizes

Color Schemes

Variants with Color Schemes

States

Use disabled and loading to communicate unavailable or in-progress actions.

With Icons

When loading, the left icon is replaced with a spinner:

Full Width

Button can render as any element using the as prop.

Common Patterns

Form Actions

Destructive Action

Button Group

Props Reference

PropTypeDefaultDescription
variant"solid" | "outline" | "ghost""solid"Visual variant
size"sm" | "md" | "lg""md"Button size
colorScheme"primary" | "accent" | "success" | "warning" | "error" | "info""primary"Color scheme
disabledbooleanfalseDisable the button
loadingbooleanfalseShow loading spinner
fullWidthbooleanfalseExpand to full width
leftIconReactNode-Icon before text
rightIconReactNode-Icon after text
asElementType"button"HTML element to render

Button also accepts all Box styling props.

TypeScript

import { Button, type ButtonVariant, type ButtonSize, type ButtonColorScheme, type ButtonProps } from "@tosui/react";