Skip to content
HomeCobalt

Button

Starts an action now: the one primary action of a view, and the grey, ghost or red forms for the rest.

Examples

Cancel first, then the one primary action, which submits the form; on a phone the primary sits on top.
  • Liquidity transformation in open-end bond funds2026
  • Fee dispersion among registered investment advisers2025
  • Flood exposure in coastal mortgages2023
  • Carbon pricing and bank lending2021
A link drawn as a buttonA press that goes to another page is a link: buttonVariants draws the anchor as a button, and it stays a link that opens in a new tab and is read as a link.
Harbour room
Seats 12, free from 2pm

Variants

Variant

Step 1 of 3: Details
PrimaryThe view's one primary action, the accent fill.
  • Sofia Reyes
SecondaryEvery other action, the grey fill.
  • Ana Lima
  • Kenji Sato
  • Maya Patel
GhostAn action inside a row, a bar or a corner, no fill at rest.
DestructiveAn action that removes something, red text on a light red background.

Size

Projector, Whiteboard

Default--control tall (36px), text-sm, with touch-target, so a coarse pointer reaches 44px.
3 filters
Small--control-sm tall (32px), with touch-target, so under a coarse pointer the hit area reaches --touch (44px) while the drawn box stays 32px.

Large--control-lg tall (40px).

States

Type a name to add a guest.

  • Mira Okafor
  • Jonas Berg
DisabledDisabled until the field is filled, with the reason beside it.
  • Autumn reading nightOct 23, 2026
  • Motion study groupOct 29, 2026
  • Tokens workshopNov 4, 2026
  • Archive tourNov 12, 2026
ExpandedThe fill stays while the button's menu is open.

Usage

Use it when

  • You start an action now: save, publish, invite, delete, open a menu.
  • The view needs one primary action, and every other action beside it.

Use something else when

  • The control is on or off, such as a filter. Use Pill instead.
  • The control stays pressed, such as bold in a toolbar. Use Toggle instead.
  • The action is slow and the button must report it. Use StateButton instead.
  • The press navigates to a page. Pass the link to render instead, so it stays a link. Use BackLink for the way back, and TextLink for a link in text.
  • The button is only an icon. Use IconButton instead, which names it once for the tooltip and the screen reader.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/button.json
import { Button, buttonVariants } from "@/components/cobalt/ui/button"