Button
When to use it
Section titled “When to use it”- To trigger a primary action, such as submitting a form or confirming a choice.
- When the action is a single, clear next step the user should take.
- For calls-to-action that need visual emphasis — use the filled/primary style.
- For secondary or less prominent actions — use the outline style instead of a second filled button.
- To open a modal, drawer, or another view, when the action is not a navigation link.
- For destructive actions (e.g. delete, remove), paired with the error/danger state.
- Inside forms, toolbars, cards, and dialogs — wherever a discrete, tappable action is needed.
When not to use it
Section titled “When not to use it”- For navigation between pages or views — use a Link component instead.
Instead: Link - When more than one primary action competes for attention on the same screen — keep only one primary button per view.
The Figma page names no alternative. - As a label or static status indicator — use a Badge/Lozenge component instead.
Instead: Badge/Lozenge - For a toggleable on/off state — use a Toggle or Checkbox component instead.
Instead: Toggle or Checkbox
Best practice
Section titled “Best practice”From the Figma documentation page (usage node 51:1158), as written. These items aren’t carried into Button.intent.json, which has no field for them.
- Use clear, action-oriented labels (e.g. “Save changes”, not “OK”).
- Keep a single primary (filled) button per screen or section; make all other actions secondary/outline.
- Always design a hover and error/disabled state so users get feedback on interaction.
- Don’t stack more than two buttons side by side without a clear visual hierarchy.
- Keep button labels to 1–3 words; avoid full sentences.
- Reserve the error/outline-error state for destructive or blocking actions only.
- Keep a minimum 40px tap target height for touch interfaces.
What each variant is for
Section titled “What each variant is for”| Property | Value | What it is for |
|---|---|---|
state |
default |
Figma doesn’t say. |
state |
hover |
Figma doesn’t say. |
state |
error |
For destructive actions (e.g. delete, remove), paired with the error/danger state. Reserve the error/outline-error state for destructive or blocking actions only. |
state |
outline |
For secondary or less prominent actions — use the outline style instead of a second filled button. |
state |
outline error |
Reserve the error/outline-error state for destructive or blocking actions only. |
Accessibility
Section titled “Accessibility”- Renders a native <button> element with type=“button”.
src/components/Button/Button.tsx:36 - Accepts native button attributes (including aria-* and disabled) and spreads them onto the <button>.
src/components/Button/Button.tsx:36 - The default icon is decorative: rendered as <img> with alt=“”.
src/components/Button/Button.tsx:33 - The visible label is rendered as text content inside the button, giving it its accessible name.
src/components/Button/Button.tsx:38 - Keyboard focus shows a 2px solid outline with a 2px offset on :focus-visible.
src/components/Button/Button.css:17
What this version promises
Section titled “What this version promises”From Versioning (VERSIONING.md at b9ffb76):
0.3.0 adds six components on top of 0.2.1: Calendar, Card, Form, Modal, SideBar and Table. It contains twenty-three components, each exported from the package root with its props type: Avatar, Breadcrumbs, Button, ButtonGroup, Calendar, Card, Checkbox, Chip, Dropdown, File, Form, Header, Image, Link, Logo, Modal, ProgressBar, RadioCard, SearchBar, SideBar, Stepper, Table, Toggle. Textfield is exported from the package root as well, with TextfieldProps and TextfieldState, and is public like the others (see decisions.md, 2026-10-07, Textfield). It commits you to their props, prop values and defaults, their hz- class names, the tokens in tokens.css and the three entry points (., ./styles.css, ./tokens.css). Everything in 0.3.0 beyond 0.2.1 is an addition: nothing from 0.2.1 was changed, removed or renamed. A change that breaks any of these on 0.x bumps the version to 0.4.0.
Two things about this release are worth knowing:
- Form, Modal and Table each passed release review with their literal sizes covered by a ruling in decisions.md (Card, SideBar and Calendar have their own), because no size tokens exist for them. Those literals are accepted until the designer adds matching tokens, so a later change to use tokens at the same rendered sizes would be a patch, not a breaking change.
- Dark theme is not verified for Table, and its warning tag has low contrast. The Table docs page says so. Neither is a breaking-change risk, but a fix that changes a token’s value is a patch and is listed in the changelog.
Stories
Section titled “Stories”All States
Section titled “All States”The single-variant stories (Default, Hover, Error, Outline, OutlineError) are rows of the variant matrix; the Design tab links each one.
Import
Section titled “Import”import { Button } from "@layerbasesystemic/horizon-design-system";import type { ButtonProps, ButtonState } from "@layerbasesystemic/horizon-design-system";@layerbasesystemic/horizon-design-system/tokens.css and @layerbasesystemic/horizon-design-system/styles.css must be loaded too; see Developing.
| Prop | Type | Default | Description |
|---|---|---|---|
text |
string |
"Label" |
— |
state |
ButtonState |
"default" |
— |
startIcon |
boolean |
true |
— |
endIcon |
boolean |
true |
— |
swapIcon |
ReactNode |
— | — |
ButtonProps also extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, so native attributes pass through to the element (Button.tsx:15).
Union types
Section titled “Union types”ButtonState: default, hover, error, outline, outline error
Tokens it needs
Section titled “Tokens it needs”Every CSS custom property Button.css reads, with its value in the token build at b9ffb76.
| Token | Light | Dark |
|---|---|---|
--border-width-md |
2px |
same as light |
--border-width-sm |
1px |
same as light |
--color-border-focus |
#1d44ba |
#6692f8 |
--color-interactive-on-primary |
#f9fafb |
#f9fafb |
--color-negative-default |
#d02727 |
#f36969 |
--color-neutral-default |
#8a909c |
#9ca2b1 |
--color-primary-default |
#2b5ad6 |
#6692f8 |
--color-primary-hover |
#1d44ba |
#94b3fc |
--color-status-error |
#d02727 |
#f36969 |
--color-text-inverse |
#f9fafb |
#161925 |
--color-text-primary |
#161925 |
#f9fafb |
--fontfamily-body |
Inter |
same as light |
--fontsize-xs |
10px |
same as light |
--lineheight-xs |
16px |
same as light |
--radius-sm |
6px |
same as light |
This matches required_tokens in Button.intent.json exactly.
Figma node
Section titled “Figma node”Page Button (6:5), component set button (19:31). The file is shared with the team only, so the frame and the link ask anyone outside it to sign in.
The page’s FigLog status reads BETA.
Variant matrix
Section titled “Variant matrix”state (5) × startIcon (2) × endIcon (2) = 20 cells. The documentation frame lays out state (rows) against StartIcon: True / False (columns), once with EndIcon: True and once with EndIcon: False.
state |
Figma node | Story |
|---|---|---|
default |
19:30 |
Default |
hover |
19:32 |
Hover |
error |
19:38 |
Error |
outline |
19:43 |
Outline |
outline error |
20:2 |
Outline Error |
startIcon: true, false. No story sets startIcon on its own; it defaults to true and can be switched with the Storybook controls.
endIcon: true, false. No story sets endIcon on its own; it defaults to true and can be switched with the Storybook controls.
Themes
Section titled “Themes”The Button page renders every cell in one theme. There is no dark-mode frame on the page.
The token build defines 179 tokens for light and redeclares 50 for dark; the Code tab shows Button’s tokens in both.
Values Figma never bound
Section titled “Values Figma never bound”Values on the Figma node that aren’t bound to a variable, and what Button.css at b9ffb76 does with each.
| Layer | Property | Figma value | In the code |
|---|---|---|---|
| button (every state) | gap | 10px |
gap: 10px; |
| button (every state) | padding | 10px |
padding: 10px; |
| button (every state) | width | 80px |
No width on .hz-button |
| icon/star (23:7) | width and height | 12px |
width: 12px; |
| state=outline, state=outline error | border width | 1px |
border: var(--border-width-sm) solid var(--color-neutral-default); |
Figma variables against the token build
Section titled “Figma variables against the token build”| Figma variable | Figma value | Token in the build | Built light value | Agrees |
|---|---|---|---|---|
--color-text-inverse |
#f9fafb |
--color-text-inverse |
#f9fafb |
yes |
--fontSize-xs |
10 |
--fontsize-xs |
10px |
yes |
--fontWeight-regular |
Regular |
no such token | — | no token |
--fontFamily-body |
Inter |
--fontfamily-body |
Inter |
yes |
--lineHeight-xs |
16 |
--lineheight-xs |
16px |
yes |
--radius-sm |
6 |
--radius-sm |
6px |
yes |
--color-primary-default |
#3b71f2 |
--color-primary-default |
#2b5ad6 |
no |
--color-interactive-on-primary |
#f9fafb |
--color-interactive-on-primary |
#f9fafb |
yes |
--color-primary-hover |
#2b5ad6 |
--color-primary-hover |
#1d44ba |
no |
--color-status-error |
#ea3d3d |
--color-status-error |
#d02727 |
no |
--color-text-primary |
#161925 |
--color-text-primary |
#161925 |
yes |
--color-neutral-default |
#8a909c |
--color-neutral-default |
#8a909c |
yes |
--color-negative-default |
#ea3d3d |
--color-negative-default |
#d02727 |
no |
--fontWeight-regular is bound in Figma but the token build has no token of that name.
4 colour variables in Figma still hold a different value from the token build, so the design file and the shipped component render --color-primary-default, --color-primary-hover, --color-status-error, --color-negative-default differently.
Design gaps recorded against it
Section titled “Design gaps recorded against it”- 2026-09-28 · Button values with no token (decisions.md). These literals in src/components/Button/Button.css are accepted, because they’re what the Figma node specifies (node 19:31), until the designer adds matching tokens. Accepted values:
10px(gap, padding on .hz-button, lines 5, 6);12px(width, height on .hz-button__icon, lines 25, 26);2px(outline-offset on .hz-button:focus-visible, line 19). Not ruled: Any other literal value, including a var() fallback. These values in any other component. A change to these values: a different number needs a new ruling or a token. - From the release review: C2: dont_use_when[1] names no alternative (“instead”: “”). This is a recorded Figma gap for the designer, not a block.
Every commit to src/components/Button up to b9ffb76, newest first, with the published version that carries it.
| Commit | Date | Version | Change |
|---|---|---|---|
d3bb44c |
2026-09-28 | 0.2.0 | Button intent: list the border-width tokens in required_tokens |
f43b8e5 |
2026-09-28 | 0.2.0 | Button: tokens only; rule the Figma values with no token; add VERSIONING.md |
41dbbdf |
2026-09-28 | 0.1.0 | Button: add intent file |
429a8f9 |
2026-09-28 | 0.1.0 | Make the repo a publishable npm package |
94900ff |
2026-09-10 | 0.1.0 | Button: match Figma node 19:31 prop/value names exactly |
2ec2ece |
2026-09-08 | 0.1.0 | testing components |