Leave Yamada UI a star

Star
Yamada UIYamada UIv1.5.1

Switch

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

Source@yamada-ui/switch

Props

SwitchProps

colorScheme

Description

The visual color appearance of the component.

Type

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

Default

primary

defaultIsChecked

Description

If true, the checkbox will be initially checked.

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

inputProps

Description

Props for switch input element.

Type

InputHTMLAttributes<HTMLInputElement>

isChecked

Description

If true, the checkbox will be checked.

Type

boolean

Default

false

isDisabled

Description

If true, the form control will be disabled.

Type

boolean

Default

false

isInvalid

Description

If true, the form control will be invalid.

Type

boolean

Default

false

isReadOnly

Description

If true, the form control will be readonly.

Type

boolean

Default

false

isRequired

Description

If true, the form control will be required.

Type

boolean

Default

false

isReverse

Description

Change switch label from right to left.

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>

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

"thick" | "thin"

Default

thick

SwitchIconProps

isActive

Type

boolean

isChecked

Type

boolean

isFocused

Type

boolean

isHovered

Type

boolean

Edit this page on GitHub

PreviousCheckboxNextToggle