Skip to content

Button

The registry button on Base UI, restyled by foundation to the 30px control and the radius ladder.

Variants

Sizes

With icon

Icon only

States

Pending

Installation

npx shadcn@latest add @khaeli/button

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items
npm packages
  • @base-ui/react ^1.7.0
  • class-variance-authority ^0.7.1

Keyboard

EnterSpace
Activates the button.
Tab
Moves focus to the button. A disabled button is a native disabled button: it leaves the tab order and cannot be activated.

Accessible name

  • The name is the button's text. Keep it a verb that says what happens: Save changes, not OK.
  • An icon-only button has no text, so give it an aria-label that says what it does. An icon beside text is decorative and needs no name.
  • A pending button keeps a name that says what is happening, such as Saving, and hides the spinner from assistive technology with aria-hidden.
  • Rendered as a link with nativeButton={false} and render, the anchor takes role="button": it is announced as a button, and Enter and Space both follow it.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/button.json