byronwade/ui
Application UI

Primitives · Application UI

Button

A polymorphic button component built on Base UI with CVA-powered variant and size styles, supporting icon-only sizes and custom render targets.

Feature showcase

Installation

Features

  • CVA-powered variants and sizes

    Covers emphasis, destructive, link, compact, large, and icon-only button shapes.

  • Polymorphic render target

    Can render as links or custom elements while preserving Base UI button semantics.

  • Built-in status affordances

    Supports loading and error states through data attributes and internal status rendering.

API

Props

PropTypeDefaultDescription
variant"default" | "outline" | "secondary" | "ghost" | "destructive" | "link""default"Visual style of the button.
size"default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"Controls height, padding, and icon sizing.
renderReact.ReactElement | ((props: object) => React.ReactElement)-Swap the underlying element (e.g. a Next.js Link); nativeButton is inferred automatically.
nativeButtonboolean-Override Base UI's native-button semantics inference when using a custom render target.
classNamestring-Additional Tailwind classes merged onto the variant styles.
disabledboolean-Disables pointer events and reduces opacity via the disabled: utilities.

Exports

ExportKindDescription
ButtoncomponentPolymorphic Base UI button primitive.
buttonVariantsconstantCVA variant helper for button styles.
ButtonPropstypePublic props for the Button component.
ButtonStatustypeStatus values used for loading and error affordances.

Slots

SlotElementDescription
buttonbuttonRoot interactive element or custom render target.
button-spinnerspanLoading indicator slot rendered inside the button.

Source and related

FilePath
Componentregistry/ui/button.tsx
Default examplecontent/examples/button/default.tsx
Variants examplecontent/examples/button/variants.tsx