Toggle

Toggle

Toggle component allows users to switch between two states.

Examples
API

Toggle component props.

PropdescriptionTypeDefault
value

The controlled value of the toggle

boolean | null

null

defaultValue

The default value of the toggle (uncontrolled)

boolean | null

null

onChange

Callback when the toggle value changes

(value: boolean) => void

undefined

disabled

Whether the toggle is disabled

boolean

false

variant

The visual variant of the toggle

'default' | 'switch'

'default'

className

Additional class name for the toggle container

string

undefined

style

Inline styles for the toggle container

React.CSSProperties

undefined

classNames

Custom class names for inner elements

{
toggle?: string

}

undefined

styles

Custom inline styles for inner elements

{
toggle?: React.CSSProperties

}

undefined

colors

Custom color variables for the toggle

{
primary?: string

bg?: string

hoverBg?: string

primaryHoverBg?: string

disabledBg?: string

switchHoverOutline?: string

switchShadow?: string

}

undefined