Skip to content

Button

Displays a button or a component that looks like a button. Built on Base UI, styled with StyleX.

Install

Bash
npx @madeui/cli add button

Usage

TSX
import { Button } from '@/components/ui/button';

<Button variant="outline">Button</Button>

Default

Secondary

Outline

Ghost

Destructive

Sizes

Icon

Use size="icon" for a square, icon-only button. Always set aria-label.

Icon sizes

icon pairs with md; use iconXs, iconSm, and iconLg to match the xs, sm, and lg text sizes.

Loading

Render a <Spinner /> before the label and set disabled to show a loading state.

Disabled

Rounded

Per-instance overrides go through the style prop — StyleX merges it last, so it always wins. No tailwind-merge, no !important.

The render prop swaps the underlying element while keeping the button styling — set nativeButton={false} when the element is not a <button>.

API reference

Built on Base UI Button. The tables below cover the props this library adds or changes — every other prop is forwarded to the underlying Base UI part; see the Base UI Button API reference for the full list.

Button

PropTypeDefaultDescription
variant'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive''primary'Visual style.
size'xs' | 'sm' | 'md' | 'lg' | 'icon' | 'iconXs' | 'iconSm' | 'iconLg''md'icon, iconXs, iconSm, iconLg render a square button.
disabledbooleanfalse
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Was this page helpful?