Forms/Switch

Switch

A toggle switch for boolean settings. Animated thumb with spring physics, fully accessible with keyboard and screen reader support.

import { Switch } from "@animui/ui"

Basic

Sizes

Disabled

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the switch is on.
defaultCheckedbooleanfalseInitial checked state (uncontrolled).
onChange(checked: boolean) => voidCalled when the switch is toggled.
labelstringVisible label rendered next to the switch.
descriptionstringSecondary description text rendered below the label.
size"sm" | "md" | "lg""md"Controls the size of the toggle track and thumb.
disabledbooleanfalsePrevents interaction and applies reduced opacity.
namestringHTML name attribute for form submission.
classNamestringAdditional classes for the wrapper element.

Accessibility

  • Renders with role="switch" and aria-checked.
  • Toggleable with Space key when focused.
  • The label prop is associated via aria-label.
© 2026 Steal Shadow. MIT License.Report an issue