DocumentationDownloads and examples

Toggle

Used to toggle on/off desired feature.

Toggle Props

NameUseTypeDefinition
checked
optional
booleanToggle value.
disabled
optional
booleanToggle is disabled.
helperTextOff
optional
stringHelper text when toggle is not checked.
helperTextOn
optional
stringHelper text when toggle is checked.
id
optional
stringAdds an id for the input in the toggle component.
label
optional
stringLabel for the toggle.
name
optional
stringAdds a name for the input in the toggle component.
onChange
optional
(checked: boolean) => voidFunction that gets called when the toggle value changes.
readOnly
optional
booleanToggle is read-only (same as disabled).
small
optional
booleanSmall toggle size.
className
optional
stringAdds any class to the parent container.

Examples

Toggle
On/Off

Sizes

Medium
This is default size
Small
For this size the small property must be passed to it

Variants

With label
This variant can be used by implementing Toggle component with label attribute, in case of small size label is not showing

I am label

With helper texts
This variant can be used by implementing Toggle component with helperTextOn and helperTextOff attributes
Off
Off

States

Disabled
Toggle component have the following states

I am label

Off
Off

I am label

On
On