Toggle

Used to toggle between two states.

When To Use

  • If you need to represent the switching between two states or on-off state.
  • The difference between Toggle and Checkbox is that Toggle will trigger a state change directly when you toggle it, while Checkbox is generally used for state marking, which should work in conjunction with submit operation.

Basic

The most basic usage.

Text & icon

With text and icon.


Disabled

Disabled state of Toggle.

Error State

Add an error state to Toggle, which could display a message.

Network error

Success State

Add a success state to Toggle.

Saved successfully!

API

Property
Description
Type
Default

label

Text label to show next to the toggle string ''

variant

Visual style of the toggle 'default' 'default'

checked

Initial checked state (uncontrolled) boolean false

error

Indicates an error state or displays an error message string | boolean

success

Indicates a success state or displays a success message string | boolean

disabled

Whether the toggle is disabled boolean false