Modal
When to use it
Section titled “When to use it”- Use type dialog to confirm an action before it happens, such as “Remove Luis Correia?”, or for a short task that must finish before going back, such as an invite.
- Use tone destructive when the action deletes or can’t be undone; show what changes in the content rows, such as “Can be undone: No”.
- Use type sheet on mobile for filters, pickers and short choices that slide up from the bottom.
3 more lines in use_when in src/components/Modal/Modal.intent.json (items 4 to 6) are Figma’s Best Practice lines, word for word. They are listed once, under “Best practice” below.
Where it goes
Section titled “Where it goes”- Centred on a color/bg/overlay backdrop (the OnOverlay story); on screen, opened from a Button as a native modal dialog (the Open* stories).
When not to use it
Section titled “When not to use it”- For information people should read while they keep working: show it on the page, or in a toast.
The Figma page names no alternative. - For long forms or anything with more than one step: use a page with Stepper.
Instead: Stepper - Open a modal from another modal.
The Figma page names no alternative.
Open item: no alternative named for items 1 and 3. Those items have an empty instead in Modal.intent.json. The Figma page names no Horizon component for them: “show it on the page, or in a toast” names a pattern, and “Open a modal from another modal” names none. This page shows “The Figma page names no alternative” and does not fill the gap.
From the release review, under “Warnings”, as written:
C2: two dont_use_when entries have an empty instead: “For information people should read while they keep working: show it on the page, or in a toast.” and “Open a modal from another modal.” Figma names no Horizon component for either.
Not enforced in code. Item 3 is Figma’s wording, kept in Modal.intent.json. Modal.tsx has no nesting guard: each <Modal open> calls showModal() on its own element (Modal.tsx:115), so two open Modals are not prevented. Treat it as guidance for the person using the component.
From the release review, under “Warnings”, as written:
“Open a modal from another modal” is not enforced in code (see above).
Best practice
Section titled “Best practice”From the Figma documentation page (usage node 244:154), as written. Modal.intent.json carries these same lines as items 4 to 6 of use_when, word for word; they are listed here once.
- Ask a question in the title and name the thing, such as “Remove Luis Correia?”, and put the result of the action on the main button, such as “Remove admin”, not “OK”.
- Always give a way out: Cancel, the close ×, the Escape key and a click on the backdrop.
- Place the dialog in the centre on a color/bg/overlay backdrop; place the sheet at the bottom, full width.
What each variant is for
Section titled “What each variant is for”| Property | Value | What it is for |
|---|---|---|
type |
dialog |
confirm an action before it happens, such as “Remove Luis Correia?”, or for a short task that must finish before going back, such as an invite |
type |
sheet |
on mobile for filters, pickers and short choices that slide up from the bottom |
tone |
default |
Figma doesn’t say. |
tone |
destructive |
when the action deletes or can’t be undone; show what changes in the content rows, such as “Can be undone: No” |
Open item: nothing for tone default. variant_intent.default is empty in Modal.intent.json because the Figma page says nothing about when to use the default tone; the other three values take their text from the Figma usage lines. This page does not write one.
From the release review, under “Warnings”, as written:
variant_intent.default is empty. Figma gap.
Accessibility
Section titled “Accessibility”- The root is a native <dialog>, so it has the dialog role; on screen it is opened with showModal(), which makes the rest of the page inert, keeps focus inside and returns it to the opener on close.
src/components/Modal/Modal.tsx:115 - The dialog is named by its title (aria-labelledby) and described by its message (aria-describedby, only when a message exists).
src/components/Modal/Modal.tsx:130 - Escape is cancelled and handed to onClose, so the owner decides when the dialog closes.
src/components/Modal/Modal.tsx:132 - A click on the backdrop calls onClose; the dialog has no padding and the panel fills it, so only a press and release that both land on the backdrop count.
src/components/Modal/Modal.tsx:145 - The close × is a native <button> with an accessible name (closeLabel, default “Close”); its icon is aria-hidden.
src/components/Modal/Modal.tsx:170 - The sheet grab handle is decorative and hidden from assistive technology.
src/components/Modal/Modal.tsx:154 - The Content rows are a description list (<dl>, <dt>, <dd>), so each label stays paired with its value.
src/components/Modal/Modal.tsx:179 - The actions are Horizon’s ButtonGroup of native buttons; the first calls onAction, the second calls onClose.
src/components/Modal/Modal.tsx:192
Gaps no ruling covers
Section titled “Gaps no ruling covers”The 2026-10-07 ruling leaves these to a human (“Not ruled”). They are open items, not waived.
Close target. The close × is 20px wide and 20px high (Modal.css:124, Modal.css:125), below the 24px minimum of WCAG 2.2 AA (success criterion 2.5.8). The size is a Figma value the 2026-10-07 ruling accepts for the stylesheet gate; the ruling does not cover the accessibility shortfall.
From the release review, under “Warnings”, as written:
Close target is 20x20 px (Modal.css:124-125), under the 24x24 px minimum of WCAG 2.2 AA success criterion 2.5.8. The size itself is accepted for gate 2 by the ruling, but the accessibility shortfall is not. [designer, then engineer; a human settles]
Initial focus. Modal.tsx sets no autoFocus and calls no focus(), so initial focus is left to the browser’s showModal() (Modal.tsx:115); QA and the release review record it landing on the close ×. For the destructive tone, focus on Cancel is the usual practice. Figma draws no focus behaviour.
From the release review, under “Warnings”, as written:
Initial focus lands on the close button. For the destructive tone, focusing Cancel first is the usual practice, so a stray Enter or Space does not confirm a deletion. Figma draws no focus behaviour. [designer to specify, then engineer]
No alertdialog role. The root is a plain <dialog> for both tones; alertdialog appears nowhere in Modal.tsx.
From the release review, under “Warnings”, as written:
No role=“alertdialog” for the destructive tone. The root is a plain <dialog> for both tones (Modal.tsx:120). [designer and engineer]
The title is not a heading. It is a <p> (Modal.tsx:160), named through aria-labelledby, so it is not in the page’s heading outline.
From the release review, under “Warnings”, as written:
The title is a <p> (Modal.tsx:160), named through aria-labelledby, not a heading, so it is not in the page’s heading outline. [engineer]
Not tested. The Tab focus trap, the real Escape key, a real backdrop click and screen-reader output were never tested: QA had no real input and no screen reader, and the release review had no browser. The facts above that describe them cite the code that should produce them; they are not evidence of the behaviour.
From the release review, under “Warnings”, as written:
Unverified accessibility behaviour: Tab focus trap, real Escape key, real backdrop click, screen-reader output. Not tested by QA, not testable here. The a11y entries that describe them cite correct code but are not evidence of behaviour. A human or a session with real input should test them. [qa, with real input]
Composition
Section titled “Composition”The stories compose Modal with: Button.
From the code. Modal.tsx is built from ButtonGroup: it imports it (Modal.tsx:4) and renders <ButtonGroup> for the actions (Modal.tsx:192), and the registry’s Composes column records it. pairs_with in Modal.intent.json lists only Button, which the stories show as the opener beside the modal (Modal.stories.tsx:106), not inside it. No story renders ButtonGroup on its own next to Modal; it appears only through Modal. This page states the composition and does not assert a pairing that the stories do not show.
From the release review, under “Warnings”, as written:
pairs_with omits ButtonGroup, which Modal composes and the board records.
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”Without Close
Section titled “Without Close”Without Content
Section titled “Without Content”Without Note
Section titled “Without Note”Custom Content
Section titled “Custom Content”All Variants
Section titled “All Variants”On Overlay
Section titled “On Overlay”Open Dialog
Section titled “Open Dialog”Open Dialog Destructive
Section titled “Open Dialog Destructive”Open Sheet
Section titled “Open Sheet”Open Sheet Destructive
Section titled “Open Sheet Destructive”The single-variant stories (Dialog, DialogDestructive, Sheet, SheetDestructive) are cells of the variant matrix; the Design tab links each one.
Import
Section titled “Import”import { Modal } from "@layerbasesystemic/horizon-design-system";import type { ModalProps, ModalType, ModalTone, ModalRow } from "@layerbasesystemic/horizon-design-system";@layerbasesystemic/horizon-design-system/tokens.css and @layerbasesystemic/horizon-design-system/styles.css must be loaded too; see Developing.
Modal.tsx is built from ButtonGroup: it imports it (Modal.tsx:4) and renders <ButtonGroup> (Modal.tsx:192). The registry’s Composes column for Modal lists ButtonGroup.
| Prop | Type | Default | Description |
|---|---|---|---|
type |
ModalType |
"dialog" |
dialog (520 wide, centred) or sheet (390 wide, rounded top, grab handle). |
tone |
ModalTone |
"default" |
default (primary actions) or destructive (error action). |
showClose |
boolean |
true |
Figma showClose: the close × in the header. |
showContent |
boolean |
true |
Figma showContent: the Content slot below the header. |
showNote |
boolean |
true |
Figma showNote: the note line under the actions. |
open |
boolean |
— | Not a Figma property. Leave undefined to draw the panel in place, as the Figma component set does (no backdrop, no focus handling). Pass true or false to show it on screen as a native modal dialog on a backdrop: focus is trapped and restored, and Escape and a click on the backdrop call onClose. |
onClose |
() => void |
— | Not a Figma property. Called by the close ×, Cancel, Escape and a click on the backdrop. |
onAction |
() => void |
— | Not a Figma property. Called by the main action button. |
title |
string |
— | Not a Figma property. Text overrides; the defaults are the Figma texts for the tone. |
message |
string |
— | — |
note |
string |
— | — |
labels |
[string, string] |
— | Not a Figma property. Main action and cancel labels. |
closeLabel |
string |
"Close" |
Not a Figma property. The accessible name of the close ×. Figma draws no text for it. |
rows |
ModalRow[] |
— | Not a Figma property. Rows of the default Content slot. |
children |
ReactNode |
— | Figma: “a Content slot with detail rows you can replace with any content”. |
ModalProps also extends Omit<HTMLAttributes<HTMLDialogElement>, "title" \| "onClose" \| "onCancel">, so native attributes pass through to the element (Modal.tsx:42).
Union types
Section titled “Union types”ModalType: dialog, sheet
ModalTone: default, destructive
Tokens it needs
Section titled “Tokens it needs”Every CSS custom property Modal.css reads, with its value in the token build at b9ffb76.
| Token | Light | Dark |
|---|---|---|
--border-width-md |
2px |
same as light |
--color-bg-elevated |
#f9fafb |
#4d5361 |
--color-bg-overlay |
#272a37 |
#272a37 |
--color-bg-surface |
#f2f3f5 |
#272a37 |
--color-border-default |
#d7dee7 |
#4d5361 |
--color-border-focus |
#1d44ba |
#6692f8 |
--color-status-error |
#d02727 |
#f36969 |
--color-text-primary |
#161925 |
#f9fafb |
--color-text-secondary |
#4d5361 |
#9ca2b1 |
--elevation-lg |
0px 8px 16px 0px rgb(8.6% 9.8% 14.5% / 0.16) |
same as light |
--fontfamily-body |
Inter |
same as light |
--fontsize-2xl |
18px |
same as light |
--fontsize-lg |
13px |
same as light |
--fontsize-sm |
11px |
same as light |
--lineheight-2xl |
26px |
same as light |
--lineheight-lg |
20px |
same as light |
--lineheight-sm |
16px |
same as light |
--radius-full |
999px |
same as light |
--radius-lg |
16px |
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-xs |
4px |
same as light |
This matches required_tokens in Modal.intent.json exactly.
Figma node
Section titled “Figma node”Page Modal (57:1650), documentation frame ❖ modal (244:68), component set modal (243:181). The file is shared with the team only, so the frame and the link ask anyone outside it to sign in.
Variant matrix
Section titled “Variant matrix”type (2) × tone (2) = 4 cells. The component set (243:181) publishes 4 variants: type=dialog, tone=default (243:3, 520x320), type=dialog, tone=destructive (243:49, 520x340), type=sheet, tone=default (243:93, 390x394) and type=sheet, tone=destructive (243:137, 390x410). ShowClose, ShowContent and ShowNote are boolean properties of the set, not variants; the documentation frame (233:12212) lays out 32 instances of them (2 types x 2 tones x ShowClose x ShowContent x ShowNote). The canvas also holds the example ‘dialog on overlay’ (244:74, 960x560, a 520 wide dialog on the color/bg/overlay rectangle) and one instance with ShowContent off (244:105). Figma draws no hover, pressed, focus or disabled state, and draws only the 390 wide sheet, with no desktop width.
type |
tone=default |
tone=destructive |
|---|---|---|
dialog |
Dialog243:3 |
DialogDestructive243:49 |
sheet |
Sheet243:93 |
SheetDestructive243:137 |
Each cell is the Storybook story for that combination and its Figma variant node. ModalType and ModalTone are the union types listed on the Code tab. The stories that aren’t a single cell (WithoutClose, WithoutContent, WithoutNote, CustomContent, AllVariants, OnOverlay, OpenDialog, OpenDialogDestructive, OpenSheet, OpenSheetDestructive) are embedded on the Examples tab.
Themes
Section titled “Themes”The modal 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 Modal’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 Modal.css at b9ffb76 does with each.
| Layer | Property | Figma value | In the code |
|---|---|---|---|
| Panel, type=dialog (243:3, 243:49) | width | 520px |
width: 520px; |
| Panel, type=sheet (243:93, 243:137) | width | 390px |
width: 390px; |
| Panel, type=sheet (243:93, 243:137) | padding-top | 10px |
padding: 10px var(--spacing-2xl) var(--spacing-2xl); |
| Panel, all four variants (243:3, 243:49, 243:93, 243:137) | drop shadow | 0 8 12, rgba(0,0,0,0.2) |
box-shadow: var(--elevation-lg); |
| Handle, type=sheet (243:95, 243:139) | width | 48px |
width: 48px; |
| Handle, type=sheet (243:95, 243:139) | height | 4px |
height: 4px; |
| Close, with ShowClose (243:8, 243:54, 243:100 and the same layer in the other sheet variant) | width | 20px |
width: 20px; |
| Close, with ShowClose (243:8, 243:54, 243:100 and the same layer in the other sheet variant) | height | 20px |
height: 20px; |
| Row, every Content slot (243:11, 243:14, 243:17, 243:57, 243:60, 243:63 and the sheet rows) | padding, top and bottom | 10px |
padding: 10px var(--spacing-md); |
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-sm |
8 |
--spacing-sm |
8px |
yes |
--spacing-md |
12 |
--spacing-md |
12px |
yes |
--fontSize-sm |
11 |
--fontsize-sm |
11px |
yes |
--lineHeight-sm |
16 |
--lineheight-sm |
16px |
yes |
--fontWeight-medium |
Medium |
no such token | — | no token |
--radius-xs |
2 |
--radius-xs |
2px |
yes |
--color-bg-surface |
#f2f3f5 |
--color-bg-surface |
#f2f3f5 |
yes |
--spacing-xs |
4 |
--spacing-xs |
4px |
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-lg |
16 |
--spacing-lg |
16px |
yes |
--spacing-2xl |
24 |
--spacing-2xl |
24px |
yes |
--color-bg-elevated |
#f9fafb |
--color-bg-elevated |
#f9fafb |
yes |
--color-status-error |
#ea3d3d |
--color-status-error |
#d02727 |
no |
--radius-full |
999 |
--radius-full |
999px |
yes |
--color-border-default |
#d7dee7 |
--color-border-default |
#d7dee7 |
yes |
--radius-lg |
16 |
--radius-lg |
16px |
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, but Modal.css doesn’t read that token, so this doesn’t change how the shipped component renders.
Design gaps recorded against it
Section titled “Design gaps recorded against it”Drop shadow. Figma draws 0 8 12 at 20% black on the four variants (unbound); the panel uses --elevation-lg (Modal.css:45), which the token build gives as 0 8 16 at 16% navy. From the 2026-10-07 ruling in decisions.md, as written:
The panel shadow in Modal.css stays on the nearest token, –elevation-lg (0 8 16 at 16% navy), against Figma’s 0 8 12 at 20% black on nodes 243:3, 243:49, 243:93 and 243:137. This deviation is accepted as a design decision (2026-10-07), the Figma nodes were not changed, and the QA report (reports/Modal/qa-report.md, round 2) records it.
From the release review, under “Warnings”, as written:
Shadow differs from Figma (accepted by ruling): code –elevation-lg 0 8 16 at 16% navy against Figma 0 8 12 at 20% black, unbound. If the designer binds the Figma shadow to a token, re-test it against the node. [designer]
The open sheet spans the viewport. On screen the sheet is width: 100% (Modal.css:64), so on a desktop viewport it is as wide as the window. Figma draws only the 390px sheet, with no desktop width, so there is nothing to check it against. Named in the ruling’s “Not ruled” line.
From the release review, under “Warnings”, as written:
Desktop sheet width is unspecified. The open sheet spans the viewport at 1440px (QA, 1440x374); Figma draws only the 390px sheet. In the ruling’s “Not ruled” line. [designer]
- 2026-10-07 · Modal sizes with no token, and the accepted shadow (decisions.md). These literals in src/components/Modal/Modal.css are accepted, because they are what the Figma nodes specify or document, until the designer adds matching size and alpha tokens. Accepted values:
520px(width,.hz-modal--dialog .hz-modal__panel, line 50);390px(width,.hz-modal--sheet .hz-modal__panel, line 57);10px(padding-top (first value of the padding shorthand),.hz-modal--sheet .hz-modal__panel, line 59);48px(width,.hz-modal__handle, line 80);4px(height,.hz-modal__handle, line 81);20px(width,.hz-modal__close, line 124);20px(height,.hz-modal__close, line 125);10px(padding-block (first value of the padding shorthand),.hz-modal__row, line 159);40%(alpha in color-mix(in srgb, var(–color-bg-overlay) 40%, transparent),.hz-modal::backdrop, line 36). 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 unitless font weights 400, 500 and 600, and the responsive limits 100%, 100dvh and max-width: 100%, which need no ruling. The inline px and color-mix in Modal.stories.tsx, which is not part of the stylesheet gate. The open-sheet width on a desktop viewport, which Figma does not draw. The 20px close target against the 24px WCAG 2.2 AA minimum, the initial focus on the close button, and the destructive tone’s missing alertdialog role, which are design and accessibility gaps for a human to settle.
Every commit to src/components/Modal up to b9ffb76, newest first, with the published version that carries it.
| Commit | Date | Version | Change |
|---|---|---|---|
1192cce |
2026-10-07 | 0.3.0 | Modal: build from Figma 57:1650 (dialog and sheet, default and destructive, composes ButtonGroup) |