Components
Toggle
Toggle
The Toggle component is a single two-state button that switches between on and off. It provides a simple and intuitive way for users to manage settings or preferences with a single click, enhancing control and customization within the interface.
Additional Examples
Outline
With Text
Small
Large
Disabled
Configurable Props
<Toggle>
Prop | Type | Default/ Options | Description |
---|---|---|---|
defaultPressed | boolean | The pressed state of the toggle when it is initially rendered. Use when you do not need to control its pressed state. | |
pressed | boolean | The controlled pressed state of the toggle. Must be used in conjunction with onPressedChange. | |
onPressedChange | function (pressed: boolean) => void | Event handler called when the pressed state of the toggle changes. | |
disabled | boolean | When true, prevents the user from interacting with the toggle. |