Skip to main content

ToggleProps

The ToggleProps object is used to render a toggle.

note

This type is deducted from Spotify's internal usage. It may not be accurate and may change in the future.

type ToggleProps = {
value: boolean;
disabled?: boolean;
onSelected: (value: boolean) => void;
id?: string;
className?: string;
}

Properties

PropertyTypeDescription
valuebooleanThe current state of the toggle. true means it's on, false means it's off.
disabledboolean | undefinedDetermines if the toggle is disabled. If true, the toggle is not interactive.
onSelected(value: boolean) => voidCallback function that is called when the toggle is clicked. The function receives the new state of the toggle.
idstring | undefinedThe ID for the toggle, useful for associating with a label for accessibility.
classNamestring | undefinedAdditional CSS class name to apply to the toggle.