Ask Natuna

Ask about the design system

Hi, I am Natuna.

Ask me about the design system: components, tokens, statuses, and how to use them.

Natuna can be wrong. The docs are the source of truth.

Skip to content
  • IntroductionPage
  • Ask NatunaAsk about the design systemPage
  • FoundationColor, type, number, effectPage
  • Components overviewPage
  • ThemesLight and dark modePage
  • NamingProperty and page namesPage
  • Privacy statementPage
  • Text-safe stepsFirst AA and AAA step per color rampSection
  • AccessibilityWCAG 2.2 AAA rulesSection
  • Dark modeThemesSection
  • Using it todayFigma file and React codeSection
  • Component statusDesign status and In ReactSection

Arrow keys to move, Enter to open, Esc to close.

Toggle

A switch for turning a single setting on or off.

Status
ReadyBuild day 3 of 21
Code
In React
Role
Form

Usage

This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.

Sent to your phone.

Pastes as editable layers. Shadows are not exported.

import { useState, type ChangeEvent } from "react";
import { Toggle } from "@/ui";

export default function ToggleDemo() {
  const [on, setOn] = useState<boolean>(true);

  return (
    <Toggle
      size="md"
      label="Transaction notifications"
      checked={on}
      onChange={(e: ChangeEvent<HTMLInputElement>) => setOn(e.target.checked)}
    />
  );
}

Variants and states

Every specimen is the real component from src/ui, held in one state.

size sm28 x 16
size md36 x 20
size lg44 x 24
Disablednative disabled. There is no error state.

Pastes as editable layers. Shadows are not exported.

Props

label
string · default none
Required visible label, connected to the switch.
hint
string · default none
Helper text under the label.
size
"sm" | "md" | "lg" · default "sm"
Track size: 28 x 16, 36 x 20, or 44 x 24.
...rest
InputHTMLAttributes · default none
Every other native input attribute, such as checked, defaultChecked, onChange, and disabled. Not id, type, or role.

Figma to code

Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.

💡 Selection
checked
Off and On are the native checked state.
📐 Size
size
sm, md, or lg.
🎯 State
disabled
Disabled is the native attribute. Hover and focus come from the browser. There is no Error state, by design.
Show Label, Label
label
The label is always shown, because a switch without a label has no name.
Show Helper Text, Helper Text
hint
Pass hint to show the line.

Accessibility

What the code in src/ui does today, and what it leaves to you.

Keyboard

  • A native checkbox with role=switch: Tab focuses it and Space toggles it.
  • A disabled toggle uses the native disabled attribute, so Tab skips it.
  • The component draws its own focus ring: 2px in the border/focus role.

Screen readers

  • Announced as a switch, with on or off as its state.
  • The label is linked with for and a generated id, so it is the accessible name.
  • The hint is linked with aria-describedby and read after the name.

What you still need to do

  • Use it for a setting that applies at once. If the choice needs a Save button, use a checkbox.
  • A setting that can fail validation is a field, not a toggle.

When to use

Binary settings that take effect immediately.

Do and don't

Do

  • Apply the change immediately, without a separate save step.
  • Label clearly what the on/off state means.

Don't

  • Use for actions that need confirmation before applying.
  • Use ambiguous labels where on/off meaning is unclear.

4 of 16 other atoms, same role and ready ones first.

See all components

Status reflects the component tracker snapshot of 29 October 2026.