Form
When to use it
Section titled “When to use it”- Use type section for a form inside a page, such as Profile, payment details or back office settings, with a Save changes and Cancel group at the end.
- Use type card for a short form on its own, such as Sign in, Create your account or Invite someone, with one full-width button.
- Build every input from textfield; use Dropdown, Checkbox, Radiocard or Toggle in the same stack when a field is a choice.
- Label every field above the input, and keep placeholders for examples, never for the label.
- Show an error under the field that caused it and say how to fix it, such as “Use a full email address”; keep what the person typed.
- Ask only for what you need, in the order people think about it, and put the main action last.
When not to use it
Section titled “When not to use it”- For one setting that applies at once: use a Toggle, without a Save button.
Instead: Toggle - To search or filter a list: use Searchbar or Chip filters.
Instead: SearchBar - For a long flow such as booking: split it into steps with Stepper type progress.
Instead: Stepper
Best practice
Section titled “Best practice”From the Figma documentation page (usage node 242:129), as written. These items aren’t carried into Form.intent.json, which has no field for them.
- Label every field above the input, and keep placeholders for examples, never for the label.
- Show an error under the field that caused it and say how to fix it, such as “Use a full email address”; keep what the person typed.
- Ask only for what you need, in the order people think about it, and put the main action last.
What each variant is for
Section titled “What each variant is for”| Property | Value | What it is for |
|---|---|---|
type |
section |
a form inside a page, such as Profile, payment details or back office settings, with a Save changes and Cancel group at the end |
type |
card |
a short form on its own, such as Sign in, Create your account or Invite someone, with one full-width button |
Accessibility
Section titled “Accessibility”- The root is a native <form> (noValidate); Enter in a field submits it, and the card’s main action is a native type=submit button.
src/components/Form/Form.tsx:85 - The title is an <h2>.
src/components/Form/Form.tsx:92 - Every field is a native <input> with a <label> tied by htmlFor, so the label is always above the input and never a placeholder.
src/components/Form/Textfield.tsx:49 - The error state sets aria-invalid and links the helper or error text with aria-describedby; the disabled state is a real disabled attribute.
src/components/Form/Textfield.tsx:56
Composition
Section titled “Composition”The stories compose Form with: Dropdown, Checkbox, Toggle.
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”Section Without Description
Section titled “Section Without Description”Section Without Field 3
Section titled “Section Without Field 3”Section Without Field 3 And 4
Section titled “Section Without Field 3 And 4”Section Without Footnote
Section titled “Section Without Footnote”Card Without Description
Section titled “Card Without Description”Card Without Link
Section titled “Card Without Link”Invite With Error
Section titled “Invite With Error”With Choice Fields
Section titled “With Choice Fields”Interaction
Section titled “Interaction”Card Keyboard
Section titled “Card Keyboard”All Variants
Section titled “All Variants”The single-variant stories (Section, Card) are rows of the variant matrix; the Design tab links each one.
Import
Section titled “Import”import { Form } from "@layerbasesystemic/horizon-design-system";import type { FormProps, FormType } from "@layerbasesystemic/horizon-design-system";@layerbasesystemic/horizon-design-system/tokens.css and @layerbasesystemic/horizon-design-system/styles.css must be loaded too; see Developing.
Form.tsx is built from Button: it imports it (Form.tsx:3) and renders <Button> (Form.tsx:102). The registry’s Composes column for Form lists Button.
Form.tsx is built from ButtonGroup: it imports it (Form.tsx:4) and renders <ButtonGroup> (Form.tsx:110). The registry’s Composes column for Form lists ButtonGroup.
Form.tsx is built from Link: it imports it (Form.tsx:5) and renders <Link> (Form.tsx:120). The registry’s Composes column for Form lists Link.
| Prop | Type | Default | Description |
|---|---|---|---|
type |
FormType |
"section" |
— |
title |
string |
"Profile" |
— |
description |
string |
"Hosts see your first name and photo when you book." |
— |
showDescription |
boolean |
true |
— |
showField3 |
boolean |
true |
section only: the third field (Display name). |
showField4 |
boolean |
true |
section only: the fourth field (Phone). |
showFootnote |
boolean |
true |
section only: the footnote under the actions. |
showLink |
boolean |
true |
card only: the link under the button. |
fields |
TextfieldProps[] |
— | Not a Figma property. Replaces the Figma fields (each field is a Textfield). |
children |
ReactNode |
— | Not a Figma property. Extra fields (Dropdown, Checkbox, Radiocard, Toggle …) added after the fields. |
footnote |
string |
"Changes show on new bookings. Bookings already confirmed keep the old details." |
Not a Figma property. Footnote text (section). |
actionLabels |
string[] |
— | Not a Figma property. Texts of the actions: section = [Save changes, Cancel], card = [Sign in]. |
linkLabel |
string |
"Forgot your password?" |
Not a Figma property. Link text and href (card). |
linkHref |
string |
"#" |
— |
onCancel |
() => void |
— | Not a Figma property. Called when the Cancel button of a section form is clicked. |
FormProps also extends Omit<FormHTMLAttributes<HTMLFormElement>, "title">, so native attributes pass through to the element (Form.tsx:11).
Union types
Section titled “Union types”FormType: section, card
Tokens it needs
Section titled “Tokens it needs”Every CSS custom property Form.css reads, with its value in the token build at b9ffb76.
| Token | Light | Dark |
|---|---|---|
--border-width-sm |
1px |
same as light |
--color-bg-elevated |
#f9fafb |
#4d5361 |
--color-border-default |
#d7dee7 |
#4d5361 |
--color-border-focus |
#1d44ba |
#6692f8 |
--color-border-subtle |
#eef1f5 |
#272a37 |
--color-state-disabled-bg |
#e5e7ed |
#4d5361 |
--color-status-error |
#d02727 |
#f36969 |
--color-text-disabled |
#d1d5db |
#6a7180 |
--color-text-primary |
#161925 |
#f9fafb |
--color-text-secondary |
#4d5361 |
#9ca2b1 |
--fontfamily-body |
Inter |
same as light |
--fontsize-2xl |
18px |
same as light |
--fontsize-lg |
13px |
same as light |
--fontsize-md |
12px |
same as light |
--lineheight-2xl |
26px |
same as light |
--lineheight-lg |
20px |
same as light |
--lineheight-md |
18px |
same as light |
--radius-xs |
2px |
same as light |
--spacing-2xl |
24px |
same as light |
--spacing-lg |
16px |
same as light |
--spacing-md |
12px |
same as light |
--spacing-sm |
8px |
same as light |
--spacing-xl |
20px |
same as light |
--spacing-xs |
4px |
same as light |
This matches required_tokens in Form.intent.json exactly.
Figma node
Section titled “Figma node”Page Form (57:1649), documentation frame ❖ form (242:61), component set form (241:91). The file is shared with the team only, so the frame and the link ask anyone outside it to sign in.
The page also holds textfield (240:37), which Figma describes as: “A labelled text input. state: default (Placeholder), focused (blue border), filled (Value), error (red border, Error message replaces the Helper), disabled. Label above, 40px input, optional Helper below (ShowHelper). Width 320, stretch to fill the form.” Its Figma variants: state=default (240:2), state=focused (240:9), state=filled (240:16), state=error (240:23), state=disabled (240:30).
Variant matrix
Section titled “Variant matrix”type (2) = 2 cells. The component set (241:91) publishes two variants, type=section (241:2, 720x510) and type=card (241:64, 440x354). ShowDescription, ShowField3, ShowField4, ShowFootnote (section) and ShowLink (card) are boolean properties of the set, not variants. The documentation frame (233:8441) lays out an 8 by 8 grid of 64 cells: 62 are instances of form, and the two cells at the top left are taken by the component set itself. Below it the canvas holds two examples (a card ‘Sign in’ and a card ‘Invite, with an error’) and the textfield set (240:37) with its five states. Figma draws no hover, pressed or focus state for the form.
type |
Figma node | Story |
|---|---|---|
section |
241:2 |
Section |
card |
241:64 |
Card |
Themes
Section titled “Themes”The form documentation frame renders every instance in one theme. It has no separate light and dark frames.
The token build defines 179 tokens for light and redeclares 50 for dark; the Code tab shows Form’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 Form.css at b9ffb76 does with each.
| Layer | Property | Figma value | In the code |
|---|---|---|---|
| form, type=section (241:2) | width | 720px |
width: 720px; |
| form, type=card (241:64) | width | 440px |
width: 440px; |
| textfield in a section form (Fields, type=section) | width | 400px |
width: 400px; |
| textfield, every state (240:2, 240:9, 240:16, 240:23, 240:30) | width | 320px |
width: 320px; |
| Input, every textfield state (240:4, 240:11, 240:18, 240:25, 240:32) | padding, top and bottom | 10px |
padding-block: calc((var(--spacing-sm) + var(--spacing-md)) / 2 - var(--border-width-sm)); |
| Value, textfield states filled, error and disabled (240:20, 240:34) | font size (the text carries 13px as a literal; the other texts bind –fontSize-lg) | 13px |
font-size: var(--fontsize-lg); |
| form border, both types (241:2, 241:64) | border colour (bound in Figma to the variable color/border/subtle, which is not named like a –color-… token; the code reads –color-border-subtle) | #eef1f5 |
box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-border-subtle); |
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-primary |
#161925 |
--color-text-primary |
#161925 |
yes |
--fontSize-2xl |
18 |
--fontsize-2xl |
18px |
yes |
--fontWeight-semibold |
Semi Bold |
no such token | — | no token |
--fontFamily-body |
Inter |
--fontfamily-body |
Inter |
yes |
--lineHeight-2xl |
26 |
--lineheight-2xl |
26px |
yes |
--color-text-secondary |
#4d5361 |
--color-text-secondary |
#4d5361 |
yes |
--fontSize-lg |
13 |
--fontsize-lg |
13px |
yes |
--fontWeight-regular |
Regular |
no such token | — | no token |
--lineHeight-lg |
20 |
--lineheight-lg |
20px |
yes |
--spacing-xs |
4 |
--spacing-xs |
4px |
yes |
--fontSize-md |
12 |
--fontsize-md |
12px |
yes |
--fontWeight-medium |
Medium |
no such token | — | no token |
--lineHeight-md |
18 |
--lineheight-md |
18px |
yes |
--spacing-md |
12 |
--spacing-md |
12px |
yes |
--radius-xs |
2 |
--radius-xs |
2px |
yes |
--border-width-sm |
1 |
--border-width-sm |
1px |
yes |
--color-bg-elevated |
#f9fafb |
--color-bg-elevated |
#f9fafb |
yes |
--color-border-default |
#d7dee7 |
--color-border-default |
#d7dee7 |
yes |
--spacing-lg |
16 |
--spacing-lg |
16px |
yes |
--color-text-inverse |
#f9fafb |
--color-text-inverse |
#f9fafb |
yes |
--fontSize-xs |
10 |
--fontsize-xs |
10px |
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-neutral-default |
#8a909c |
--color-neutral-default |
#8a909c |
yes |
--spacing-xl |
20 |
--spacing-xl |
20px |
yes |
--spacing-2xl |
24 |
--spacing-2xl |
24px |
yes |
--color-text-link |
#1d44ba |
--color-text-link |
#1d44ba |
yes |
--color-status-error |
#ea3d3d |
--color-status-error |
#d02727 |
no |
--color-border-focus |
#1d44ba |
--color-border-focus |
#1d44ba |
yes |
--color-text-disabled |
#d1d5db |
--color-text-disabled |
#d1d5db |
yes |
--color-state-disabled-bg |
#e5e7ed |
--color-state-disabled-bg |
#e5e7ed |
yes |
--fontWeight-semibold, --fontWeight-regular, --fontWeight-medium are bound in Figma but the token build has no token of that name.
1 colour variable in Figma still holds a different value from the token build, so the design file and the shipped component render --color-status-error differently.
--color-primary-default holds a different value in Figma from the token of the same name in the build. Form.css doesn’t read that token, but the stylesheet of the component Form is built from does (Button.css), so the Button rendered inside Form uses the build’s value, not Figma’s.
Design gaps recorded against it
Section titled “Design gaps recorded against it”- 2026-10-07 · Form widths with no token (decisions.md). These literals in src/components/Form/Form.css are accepted, because they are what the Figma nodes specify, until the designer adds matching size tokens. Accepted values:
720px(width,.hz-form--section, line 27);440px(width,.hz-form--card, line 32);400px(width,field inside a section form, line 71);320px(width,.hz-textfield, line 95). 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. The public export of Textfield, TextfieldProps and TextfieldState from src/index.ts, which the review raised as a warning.
Every commit to src/components/Form up to b9ffb76, newest first, with the published version that carries it.
| Commit | Date | Version | Change |
|---|---|---|---|
f10ec35 |
2026-10-07 | 0.3.0 | Form: input 40px per Figma (absorb border into padding-block) |
ea4519b |
2026-10-07 | 0.3.0 | Form: build from Figma 57:1649 (section + card, composes Button, ButtonGroup, Link) |