Toggle

A binary on/off switch. Two variants — Active and Inactive — with all colors, sizing and geometry pulled directly from the LUSTER Figma component.

Figma Properties
Variant: Active
Track color: #916DFF
Knob color: #FFFFFF
Size: 38 × 22px
Knob: 16 × 16px
Border: 2px · Padding: 3px

Tip: click the toggle to switch it.

Variant

Active
Inactive

Design Tokens

Token NameFigma VariableDefault Value
--toggleOnBgColorToggle/On/Bg/Color#916DFF
--toggleOnBorderColorToggle/On/Border/Color#916DFF
--toggleOnCircleBgColorToggle/On/Circle/Bg/Color#FFFFFF
--toggleOffBgColorToggle/Off/Bg/Color#8F8B96
--toggleOffBorderColorToggle/Off/Border/Color#8F8B96
--toggleOffCircleBgColorToggle/Off/Circle/Bg/Color#FFFFFF
--toggleSizeWidthToggle/Size/Width38px
--toggleSizeHeightToggle/Size/Height22px
--toggleCircleSizeWidthToggle/Circle/Size/Width16px
--toggleCircleSizeHeightToggle/Circle/Size/Height16px
--togglePaddingXToggle/Padding/X3px
--togglePaddingYToggle/Padding/Y3px
--toggleBorderWidthToggle/Border/Width2px
--toggleBorderRadiusToggle/Border/Radius0px
--toggleCircleBorderRadiusToggle/Circle/Border/Radius0px

Usage Guidelines

✓ DO

Use a toggle for an immediate on/off setting that applies instantly.

✓ DO

Pair the toggle with a clear text label describing what it controls.

✕ DON'T

Don't use a toggle when changes require a separate Save action — use a checkbox.

✕ DON'T

Don't rely on color alone — keep the knob position meaningful.

Implementation

Values shown are the Diamond brand, Light mode defaults (the Figma file's default mode). Other brands (Amber, Opal) and Dark mode resolve to different values via the Color Theme & Component Brand collections.

import React from 'react';
import './Toggle.css';

export interface ToggleProps {
  checked: boolean;
  onChange: (next: boolean) => void;
  disabled?: boolean;
  'aria-label'?: string;
}

export const Toggle = ({ checked, onChange, disabled, ...props }: ToggleProps) => (
  <button
    type="button"
    role="switch"
    aria-checked={checked}
    disabled={disabled}
    className={`toggle ${checked ? 'toggle--on' : 'toggle--off'}`}
    onClick={() => onChange(!checked)}
    {...props}
  >
    <span className="toggle__knob" />
  </button>
);