Switch API
API documentation for Switch component
SwitchRoot#
Props#
Defines valid properties in Switch component.
State#
Defines valid state in Switch component.
Exposes#
Defines the methods and properties exposed by Switch component.
| name | type | default | description |
|---|---|---|---|
| state | useSwitchState | null | The state of the useSwitch. |
| onChange | (event: useSwitchChangeEvent) => void | null | Callback fired when the useSwitch's checked state changes. |
Events#
SwitchRootChangeEvent
Event fired when the switch's checked state changes.
| name | type | description |
|---|---|---|
| value | unknown | Value of the switch. |
| originalEvent | ChangeEvent | The original event that triggered the change. |
| checked | boolean | The checked state of the switch. |
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of Switch component.
Types#
Instance
Instance of Switch component.
| values |
|---|
| ComponentInstance<SwitchRootProps, SwitchRootState, SwitchRootExposes> |
SwitchControl#
Props#
Defines valid properties in SwitchControl component.
Exposes#
Defines the methods and properties exposed by SwitchControl component.
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of SwitchControl component.
| name | type | default | description |
|---|---|---|---|
| root | SwitchControlPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the root's DOM element. |
Types#
Instance
Instance of SwitchControl component.
| values |
|---|
| ComponentInstance<SwitchControlProps, SwitchControlState, SwitchControlExposes> |
SwitchThumb#
Props#
Defines valid properties in SwitchThumb component.
Exposes#
Defines the methods and properties exposed by SwitchThumb component.
Interfaces#
PassThroughOptions
Defines passthrough(pt) options of SwitchThumb component.
| name | type | default | description |
|---|---|---|---|
| root | SwitchThumbPassThroughType<HTMLAttributes<HTMLDivElement>> | null | Used to pass attributes to the root's DOM element. |
Types#
Instance
Instance of SwitchThumb component.
| values |
|---|
| ComponentInstance<SwitchThumbProps, SwitchThumbState, SwitchThumbExposes> |
useSwitch#
Props#
Defines valid properties in useSwitch.
State#
Defines valid state in useSwitch.
Exposes#
Defines the methods and properties exposed by useSwitch.
| name | type | default | description |
|---|---|---|---|
| state | useSwitchState | null | The state of the useSwitch. |
| onChange | (event: useSwitchChangeEvent) => void | null | Callback fired when the useSwitch's checked state changes. |
Events#
useSwitchChangeEvent
Event fired when the switch's checked state changes.
| name | type | description |
|---|---|---|
| originalEvent | E | The original event that triggered the change. |
| checked | boolean | The checked state of the switch. |
Types#
Instance
Instance of useSwitch headless.
| values |
|---|
| HeadlessInstance<useSwitchProps, useSwitchState, useSwitchExposes> |