Toggle API

API reference docs for theTogglecomponent. For examples and details on the usage of this component, visit the component demo page.

Props

PropTypeDescriptionDefault
labelReactNodeLabel for the toggle describing its purpose._
isDisabled?booleanDisables the toggle, making it non-interactive and visually styled as disabled.false
size?'standard'| 'large'The size of the toggle.standard
value?stringDefines the value of the toggle input, used when submitting a form._
checked?booleanSets the checked state of the toggle when using controlled components._
id?stringA unique ID for the toggle._
name?booleanThe name attribute of the toggle, useful for grouping in forms._
description?ReactNodeDescription text displayed alongside the toggle, providing additional context._
aria-describedby?stringThe ID of the element that describes the toggle for accessibility._
onBlur?functionEvent handler triggered when the toggle loses focus._
onClick?functionEvent handler triggered when the toggle is clicked._
onChange?functionEvent handler triggered when the toggle value changes._
togglePosition?'start' | 'end'Placement of the toggle primitive relative to the label. 'start' shows the label on the left and toggle on the right; 'end' reverses this.start