Button

Triggers an action or event when activated.

Overview

The Button component provides a versatile and customizable button system with multiple variants, appearances, sizes, and shapes. It supports polymorphic rendering with the render prop (Base UI pattern), as well as special features like pending states and URL state management.

Use Button.Wrapper to visually attach adjacent buttons for split-button layouts while keeping each inner action as a real Button.

Usage

import { Button } from "@tilt-legal/cubitt-components/button";
<Button>Click me</Button>

Examples

Secondary

Frost

Destructive

Outline

Ghost

With Icon

Icon Only

Tooltip

Use tooltip to attach compact context to icon-only or disabled actions without wrapping the button manually.

Icon Label Transition

Keep a plain text label mounted and toggle mode="icon" when a button needs to collapse to its icon-only form. Cubitt handles the visual label transition while preserving the button's accessible name.

Pending

Shows a loading spinner while an action is in progress.

With Badge

Combine buttons with badges for notifications and counters.

Sizes

Style buttons as links using variant="link".

Split Button

Use Button.Wrapper when you want a primary action and an adjacent secondary trigger to read as a single control.

Disabled

URL State

Sync button clicks with URL parameters. Click a button to see the URL update with the corresponding action.

API Reference

Button

The root component for creating buttons with multiple variants, appearances, sizes, and shapes. Supports polymorphic rendering via the render prop and URL state management.

PropTypeDefaultDescription
variant"default" | "secondary" | "mono" | "inverse" | "destructive" | "frost" | "outline" | "ghost" | "link""default"Visual style variant.
size"sm" | "md" | "lg""md"Button size.
mode"icon" | "input"—Layout mode. Use icon for square icon buttons and input for form trigger styling.
unstyledbooleanfalseRender as a completely unstyled button.
pendingbooleanfalseShow a loading spinner. Leading icons swap immediately; other layouts keep the animated inline indicator.
tooltipButtonTooltip—Optional tooltip content or configuration. Disabled tooltip buttons use aria-disabled so the tooltip can still open.
selectedbooleanfalseMark the button as selected for toggle or popup-trigger states.
disabledbooleanfalseDisable the button.
reduceMotionbooleanfalseDisable Button-owned animations.
renderReactElement | function—Render as another element while preserving Button behavior.
classNamestring—Additional classes for the button.

ButtonTooltip

The tooltip prop accepts a ReactNode or an object with these fields.

PropertyTypeDefaultDescription
contentReactNode—Tooltip content. Required for object form.
delaynumber500Hover/focus delay in milliseconds.
side"top" | "right" | "bottom" | "left" | "inline-start" | "inline-end""top"Preferred tooltip side.
sideOffsetnumber8Distance from the button in pixels.
align"start" | "center" | "end""center"Alignment along the selected side.
alignOffsetnumber0Offset along the alignment axis.
classNamestring—Additional classes for the tooltip content.

URL State Props

When provided with a paramName, the button will set URL parameters when clicked.

PropTypeDefaultDescription
paramNamestring—URL parameter name. Enables URL state management.
paramSetValuestring—Value to set in the URL when the button is clicked.
paramThrottlenumber—Throttle URL updates in milliseconds.
paramDebouncenumber—Debounce URL updates in milliseconds.

On this page