Clinia UI

Button

Starts the action the user came to do: save, create, confirm.

shadcn docs →

When to use

  • Trigger an action on this page: save, create, confirm, delete.
  • Submit a form.

When not to use

  • Go to another page: use a link, or buttonVariants() on a Link.
  • Turn a setting on or off: use Switch or Toggle.
  • Pick one of several views: use Tabs or Toggle Group.

Install

npx shadcn@latest add @clinia/button

Marketing (Sera)

Anatomy

  1. 1Containerdata-slot="button"bg-primary · rounded-lg
  2. 2Icon (optional)[data-icon]size-4 · currentColor
  3. 3Label[data-part=label]text-sm · font-medium

Clinia rules

  • default is the one main action in a view: an Infinite fill, inverted in dark. It is never a Trust fill, because Trust can't carry label-size text.
  • Labels are sentence case and start with a verb that names the result: Create source, not OK.
  • Keep the Trust focus ring. Don't override it with a custom outline.
  • destructive is a tinted fill with destructive text, not a solid red button.

Do and don't

Do keep one main action per view.
Don't put two main actions side by side.
Do start the label with a verb that names the result.
Don't use a label that says nothing about the result.

States: product (Luma)

default
default · disabled
secondary
secondary · disabled
outline
outline · disabled
ghost
ghost · disabled
destructive
destructive · disabled
link
link · disabled
focus
invalid
loading
with icon
icon only
size xs
size sm
size lg

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

States: marketing (Sera)

default
default · disabled
secondary
secondary · disabled
outline
outline · disabled
ghost
ghost · disabled
destructive
destructive · disabled
link
link · disabled
focus
invalid
loading
with icon
icon only
size xs
size sm
size lg

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

Sizes

SizeHeightPadding xGapRadiusType
defaulth-9 · 36pxpx-3 · 12pxgap-1.5 · 6px--radius-lgtext-sm · 14px
xsh-6 · 24pxpx-2.5 · 10pxgap-1 · 4px--radius-lgtext-xs · 12px
smh-8 · 32pxpx-3 · 12pxgap-1 · 4px--radius-lgtext-sm · 14px
lgh-10 · 40pxpx-4 · 16pxgap-1.5 · 6px--radius-lgtext-sm · 14px
iconsize-9 · 36px––--radius-lgtext-sm · 14px
icon-xssize-6 · 24px––--radius-lgtext-sm · 14px
icon-smsize-8 · 32px––--radius-lgtext-sm · 14px
icon-lgsize-10 · 40px––--radius-lgtext-sm · 14px

Accessibility

Built in

  • Focus-visible shows a solid Trust ring (border-ring ring-3 ring-ring/30); aria-invalid swaps it to a destructive ring.

Your responsibility

  • Give icon-only sizes (icon, icon-sm…) an aria-label: the icon is decorative and names nothing.
  • Navigation is a link, not a button with an onClick. Put buttonVariants() on the Link to keep the look.
  • Disable a button only when the reason is visible nearby. Otherwise keep it enabled and explain the problem when it's pressed.
  • While it's loading, set disabled and change the label to say what's happening (Saving). A screen reader doesn't read the change by itself, so announce the result in a toast or a status message.

How to test

  1. Press Tab until the button has focus: the Trust ring appears.
  2. Press Enter, then Space: each one activates it.
  3. With a screen reader, it's announced as its label, then as a button. Icon-only buttons announce their aria-label.

API

PropValuesDefaultDescription
variant
defaultoutlinesecondaryghostdestructivelink
default

Emphasis. default for the one main action, secondary or outline beside it, ghost in toolbars and rows, destructive for delete, link inside text.

size
defaultxssmlgiconicon-xsicon-smicon-lg
default

Height: xs 24px, sm 32px, default 36px, lg 40px. icon-* sizes are square and need an aria-label.

All other props come from Base UI Button.