Search documentation

Find a component or a docs page

Button

Displays a button or a component that looks like a button.

Usage

Default

Outline

Secondary

Ghost

Destructive

Sizes

size: :xs, :sm, :md (the default), :lg and :xl.

Icon

icon: true makes a square button of the given size. Give it an aria-label.

With icon

Mark the icon with data-icon="inline-start" or "inline-end" so the button tightens the padding on that side. Icons are sized to 16px (12px on :xs) unless they carry a size-* class.

Loading

Disabled

Focusable when disabled

focusable_when_disabled: true keeps a disabled button in the tab order (aria-disabled instead of disabled), for example so a tooltip can explain why. Clicks and keyboard activation are blocked. As in shadcn, only the disabled attribute dims a button, so this one keeps its enabled look.

Invalid

aria-invalid paints the border and focus ring in the destructive color.

Submit

Installation

Components

ComponentBuilt usingSource
ButtonPhlex
ButtonDocsPhlex
ButtonControllerStimulus JS