CodeAI

Toggle

On/off switch with optional track icons (defaults check/xmark). Heights match Checkbox/Radio (22/20/18/16). Public API maps Figma Toggle + Label; track chrome from Toggle building block. Distinct from IconToggle.

Appearance

Content

State

Accessibility

Props — Toggle
View MUI docs
PropTypeDescription
size"large" | "medium" | "small" | "extraSmall"Track and label scale.
labelPlacement"left" | "right"Label on the left or right of the switch.
labelReactNodeLabel beside the switch.
checkedbooleanControlled on/off state.
defaultCheckedbooleanUncontrolled initial on/off state.
disabledbooleanDisables interaction.
onChange(event, checked) => voidCalled when toggled.
hasIconsbooleanShow check/xmark icons on the track.
onIconFaIconNameTrack icon when on. Ignored when hasIcons is false.
offIconFaIconNameTrack icon when off. Ignored when hasIcons is false.
aria-labelstringRequired when unlabeled.