Skip to main content

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

AttributesValuesOptional ?
statusbooleanNo
onChangeReact.Dispatch<React.SetStateAction<boolean>>No
isDisabledbooleanYes