Skip to content

Search

Start typing to search.


Show all pages

Documentation

controls

Button

Triggers an action, such as saving a form or opening a dialog.

CSS onlyPlain classes; no JavaScript in any stack.

Usage

A button needs the component class, one variant and one size.

HTML

Examples

Variants

Use one primary button per view for the main action; secondary, outline and ghost rank below it.

HTML

Sizes

Pick the size that matches the surrounding controls. On touch screens every size keeps a 44 by 44 pixel target.

HTML

Disabled

Use disabled when the action can never apply. Use aria-disabled="true" with an explanation when people should still find the button and learn why it is unavailable.

Select at least one row to export.

HTML

Use an <a> with button classes when the action navigates to another page.

HTML

Guidance and accessibility

When to use

  • Use a button for actions: saving, sending, opening and closing.
  • Use a link for navigation. If it looks like a button but goes somewhere, render an <a> with button classes.
  • Start the label with a verb and name the object, such as “Save draft” or “Delete project”. A bare “OK” or “Submit” does not say what happens.

Accessibility

  • Use a real <button> with type="button", or type="submit" inside a form. Do not put button classes on a <div>.
  • The core keeps a visible 2 pixel focus ring that skins cannot remove, and a touch target of at least 44 by 44 pixels on coarse pointers.
  • A button with only an icon needs an aria-label that names the action.
  • Prefer aria-disabled="true" over disabled when people need to discover the button and read why it is unavailable; point aria-describedby at the explanation. Calaca styles both the same way.

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the button component
ClassKindUse it for
ca-buttonComponentLayout, focus ring, disabled behavior and touch target.
ca-button--primaryVariantThe main action of a view.
ca-button--secondaryVariantA strong action that is not the main one.
ca-button--outlineVariantA lower-emphasis action with a visible boundary.
ca-button--ghostVariantThe lowest emphasis, for actions such as Cancel.
ca-button--smSizeCompact size for dense toolbars and tables.
ca-button--mdSizeDefault size.
ca-button--lgSizeProminent size for marketing pages and empty states.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />