Switch

Switch

Components

A control that allows the user to toggle between checked and not-checked states with fluid spring animations.

Interactive Switch

A toggle component built according to WAI-ARIA switch pattern design standards. Supports keyboard interaction, descriptions, disabled states, and spring animations.

Enable notifications

Props Reference

PropTypeDefaultDescription
labelstring"Push Notifications"Label text displayed alongside the switch
descriptionstringundefinedSecondary descriptive helper text
defaultCheckedbooleanfalseInitial boolean toggled state
disabledbooleanfalseWhether interaction is disabled
onChange(checked: boolean) => voidundefinedCallback fired when the toggle state changes

Accessibility & Keyboard Shortcuts

  • Role: Explicit role="switch" attribute informing screen readers of a two-state control.
  • State: Dynamic aria-checked={enabled} reflecting live state changes.
  • Keyboard Navigation:
    • Tab: Focuses into the switch element.
    • Space / Enter: Toggles the checked state.
  • Reduced Motion: Gracefully falls back when system reduces animation motion.