Switch
Quick start
Here's a quick start guide to get started with the switch component
Importing Component
import { Switch } from "@hover-design/react";
Code Snippets and Examples
Toggle switch
<div className="App">
<Switch status="{stateVariable}" onChange="{setStateVariable}" />
</div>
Toggle switch off state
Toggle switch on state
Disabled switch
<div className="App">
<Switch
status="{stateVariable}"
onChange="{setStateVariable}"
isDisabled="{true}"
/>
</div>
Disabled switch off state
Disabled switch on state
Props Reference
Attributes | Values | Optional ? |
---|---|---|
status | boolean | No |
onChange | React.Dispatch<React.SetStateAction<boolean>> | No |
isDisabled | boolean | Yes |