Button

Triggers an action or event, such as submitting a form, opening a dialog, or saving changes.

components/ui/button.tsx

Installation

npx betterone-ds add button

Variants

Pick the variant that matches the importance of the action.

Defaultprimary action
Secondarysupporting
Outlinecancel, back
Ghosttoolbars
Destructiveirreversible
Linkinline text

Sizes

sm · 32px
default · 36px
lg · 40px
icon · 36px

With icon

Put an icon before or after the label, or use an icon-only button. Icons size themselves from the icon tokens, so no size class is needed.

leading icon
trailing icon
secondary
destructive
icon only
loading
with-icon.tsx
import { ArrowRight, EnvelopeSimple, Plus } from "@phosphor-icons/react"
<Button><EnvelopeSimple /> Login with email</Button><Button variant="outline">Continue <ArrowRight /></Button><Button size="icon" aria-label="Add item"><Plus /></Button>

States

Hover and focus are shown as fixed styles here. In the app they respond to the pointer and keyboard.

default
hover
focus-visible
disabled
loading

Props

PropTypeDefault
variant"default" | "secondary" | "outline" | "ghost" | "destructive" | "link""default"
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"
isDisabledbooleanfalse

Usage

DoUse one primary button per view. Pair it with an outline or ghost button for secondary actions.
Don'tDon't put two primary buttons side by side. People won't know which action matters most.
usage.tsx
import { Button } from "@/components/ui/button"
export function SaveBar() {  return (    <div className="flex gap-3">      <Button>Save changes</Button>      <Button variant="outline">Cancel</Button>    </div>  )}

Accessibility