Skip to content

Toggle

ReleasedShipped in 0.2.0StorybookFigma node 145:2Source
  • To turn a single setting on or off, such as a notification (“Check in reminders”, “Price drop alerts”).
  • For a setting that takes effect immediately, without a Save button.
  • Use size md in settings lists, with the label and helper text on the left and the toggle on the right; use size sm in dense tables, such as the Email, Push and SMS columns.
  • Use a disabled state for a setting the user can’t change, such as booking confirmations that are always sent.

Where the built component differs. Item 3 (145:824) above is copied from Figma as written, and assumes a label and helper text laid out beside the toggle. Toggle.tsx renders one element, the <input type="checkbox" role="switch"> (Toggle.tsx:14-19), with no label or helper-text slot, and the Figma component description says “No built-in label: place the setting’s label beside it.” (node 144:20).

  • For a choice submitted together with a form, such as agreeing to terms: use the Checkbox component instead.
    Instead: Checkbox
  • When the user must choose one of several options: use the Radiocard component instead.
    Instead: Radiocard
  • To trigger an action, such as saving or sending: use the Button component instead.
    Instead: Button

From the Figma documentation page (usage node 145:712), as written. These items aren’t carried into Toggle.intent.json, which has no field for them.

  • Always pair the toggle with a visible label that names the setting, not its state (“Price drop alerts”, not “On”).
  • Apply the change straight away; don’t make the user press Save afterwards.
  • Leave optional notifications and marketing off by default.
  • Explain why a disabled toggle can’t be changed in the helper text (for example, “Always on, cannot be changed”).
  • Make the whole row clickable, not only the switch.
  • Give the toggle the switch role and its label for assistive technology (role=“switch” with aria-checked).

Where the built component differs. Items 4 (145:872) and 5 (145:878) are copied from Figma as written. They describe helper text and a clickable whole row, which Toggle.tsx doesn’t provide: it renders only the bare switch, one <input> (Toggle.tsx:14-19), with no helper-text slot and no row to click. The label goes beside it, as the Figma component description says (node 144:20).

Item 6 (145:884) names role="switch" with aria-checked. Toggle.tsx sets the role on a native checkbox input (Toggle.tsx:16) and never sets aria-checked. The control is a native <input type=“checkbox”> with role=“switch”, so keyboard, focus and disabled behaviour are the browser’s own, and the checked state maps natively to the switch state (no manual aria-checked).

From the release review, as written:

Usage lines the built component doesn’t provide. Use-when item 3 (carried verbatim into the intent file) says to put “the label and helper text on the left and the toggle on the right”; Best Practice items say to explain a disabled toggle “in the helper text” and to “make the whole row clickable”. Toggle is the bare switch: no label, helper text or row, and Figma draws only the switch. Owner: the designer (draw the row or trim the lines); the engineer builds it if drawn.

Best Practice says aria-checked; the code doesn’t set it. The native <input type=“checkbox” role=“switch”> maps checked to the switch state without aria-checked, as the intent’s first a11y entry says. Mechanism differs from the Figma wording only.

Property Value What it is for
size md default; settings lists
size sm dense tables
  • The control is a native <input type=“checkbox”> with role=“switch”, so keyboard, focus and disabled behaviour are the browser’s own, and the checked state maps natively to the switch state (no manual aria-checked). src/components/Toggle/Toggle.tsx:16
  • There is no built-in label; callers supply aria-label or wrap the input in a <label> to give it an accessible name. src/components/Toggle/Toggle.stories.tsx:12

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.