Leave Yamada UI a star

Star
Yamada UIYamada UIv1.7.2

Switch

Switch is a component used to toggle between on and off states.

Source@yamada-ui/switch

Props

SwitchIconProps

active

Type

boolean

checked

Type

boolean

focused

Type

boolean

hovered

Type

boolean

isActive

Deprecated

Deprecated

Use active instead.

Type

boolean

isChecked

Deprecated

Deprecated

Use checked instead.

Type

boolean

isFocused

Deprecated

Deprecated

Use focused instead.

Type

boolean

isHovered

Deprecated

Deprecated

Use hovered instead.

Type

boolean

SwitchProps

checked

Description

If true, the checkbox will be checked.

Type

boolean

Default

false

colorScheme

Description

The visual color appearance of the component.

Type

"blackAlpha" | "whiteAlpha" | "amber" | "blue" | "info" | "link" | "primary" | "cyan" | "emerald" | "flashy" | "fuchsia" | "gray" | "green" | "success" | "indigo" | "lime" | "neutral" | "orange" | "warning" | "pink" | "purple" | "red" | "danger" | "rose" | "sky" | "teal" | "violet" | "secondary" | "yellow"

Default

"primary"

defaultChecked

Description

If true, the checkbox will be initially checked.

Type

boolean

Default

false

defaultIsChecked

Deprecated

Description

If true, the checkbox will be initially checked.

Deprecated

Use defaultChecked instead.

Type

boolean

Default

false

disabled

Description

If true, the form control will be disabled.

Type

boolean

Default

false

icon

Description

The switch icon to use.

Type

ReactElement<SwitchIconProps, string | JSXElementConstructor<any>>

id

Description

id assigned to input.

Type

string

indeterminate

Description

If true, the checkbox will be indeterminate.

Type

boolean

Default

false

inputProps

Description

Props for switch input element.

Type

InputHTMLAttributes<HTMLInputElement>

invalid

Description

If true, the form control will be invalid.

Type

boolean

Default

false

isChecked

Deprecated

Description

If true, the checkbox will be checked.

Deprecated

Use checked instead.

Type

boolean

Default

false

isDisabled

Deprecated

Description

If true, the form control will be disabled.

Deprecated

Use disabled instead.

Type

boolean

Default

false

isInvalid

Deprecated

Description

If true, the form control will be invalid.

Deprecated

Use invalid instead.

Type

boolean

Default

false

isReadOnly

Deprecated

Description

If true, the form control will be readonly.

Deprecated

Use readOnly instead.

Type

boolean

Default

false

isRequired

Deprecated

Description

If true, the form control will be required.

Deprecated

Use required instead.

Type

boolean

Default

false

isReverse

Deprecated

Description

Change switch label from right to left.

Deprecated

Use reverse instead.

Type

boolean

Default

false

labelProps

Description

Props for switch label element.

Type

HTMLUIProps<"span">

name

Description

The HTML name attribute used for forms.

Type

string

onBlur

Description

The callback invoked when the checkbox is blurred.

Type

FocusEventHandler<HTMLInputElement>

onChange

Description

The callback invoked when the checked state changes.

Type

ChangeEventHandler<HTMLInputElement>

onFocus

Description

The callback invoked when the checkbox is focused.

Type

FocusEventHandler<HTMLInputElement>

readOnly

Description

If true, the form control will be readonly.

Type

boolean

Default

false

required

Description

If true, the form control will be required.

Type

boolean

Default

false

reverse

Description

Change switch label from right to left.

Type

boolean

Default

false

selectOnEnter

Description

If true, the checkbox will be selected when the Enter key is pressed.

Type

boolean

Default

false

size

Description

The size of the Switch.

Type

"sm" | "md" | "lg"

Default

"md"

tabIndex

Description

The tab-index property of the underlying input element.

Type

number

transition

Description

Motion transition settings.

Type

Transition$1

value

Description

The value to be used in the checkbox input.

Type

string

variant

Description

The variant of the Switch.

Type

"thin" | "thick"

Default

"thick"

Edit this page on GitHub

PreviousCheckboxCardNextToggle