Switch API
API reference for the Switch components.
IDUnique identifier (auto-generated if not provided)
Default: useId()
stringOptional display label (passed through to slot)
VValue associated with this switch (used in group mode and form submission)
stringForm field name - triggers auto hidden input when provided
stringAssociate with form by ID
MaybeRef<boolean>Disables this switch
Default: false
MaybeRef<boolean>Sets the indeterminate state
Default: false
stringNamespace for context provision to children (Track, Thumb, HiddenInput)
Default: "v0:switch:root"
stringNamespace for connecting to parent Switch.Group
Default: "v0:switch:group"
stringID of element that labels this switch
stringID of element that describes this switch
booleanWhether the switch has an invalid value
stringNamespace for context provision to children
Default: "v0:switch:group"
booleanDisables all switches in the group
Default: false
booleanAuto-select items on registration
Default: false
boolean | "force"Require at least one switch to be on. `'force'` prevents deselecting the last item
Default: false
stringAccessible group label
stringID of element that labels this group
stringID of element that describes this group
stringForm field value (overrides Root's value, defaults to 'on')
stringForm field name (overrides Root's name)
stringNamespace for connecting to parent Switch.Root
Default: "v0:switch:root"
stringAssociate with form by ID (overrides Root's form)
stringAccessible label for the select-all toggle
booleanDisables this toggle
stringNamespace for context provision to children (Track, Thumb)
stringNamespace for connecting to parent Switch.Group
stringID of element that labels this toggle
stringID of element that describes this toggle
stringNamespace for connecting to parent Switch.Root
Default: "v0:switch:root"
stringNamespace for connecting to parent Switch.Root
Default: "v0:switch:root"