The Switch component is used as an alternative for the Checkbox
component. You can switch between enabled or disabled states.
import { Switch } from "@deca-ui/react"
<Switch initialToggle label="Switch" />
Use the disabled
prop to disable the Switch.
<Switch disabled label="Switch" />
<Switch initialToggle disabled label="Switch" />
Use the size
prop to change the size of the Switch. You can set the value to sm
, md
, or lg
.
<Switch size="sm">Small</Switch>
<Switch size="md">Medium</Switch>
<Switch size="lg">Large</Switch>
Use the color
prop to change the color of the Switch. You can set the value to primary
, secondary
, success
, warning
or error
.
<Switch initialToggle color="primary" label="Primary" />
<Switch initialToggle color="secondary" label="Secondary" />
<Switch initialToggle color="warning" label="Warning" />
<Switch initialToggle color="success" label="Success" />
<Switch initialToggle color="error" label="Error" />
Made by Heril Saha