Switch

The Switch component is used as an alternative for the Checkbox component. You can switch between enabled or disabled states.

Import

import { Switch } from "@deca-ui/react"

Usage

<Switch initialToggle label="Switch" />

Disabled

Use the disabled prop to disable the Switch.

<Switch disabled label="Switch" />
<Switch initialToggle disabled label="Switch" />

Sizes

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>

Colors

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" />
Headshot

Made by Heril Saha