@chakra-ui/switch
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Switch

The Switch component is used as an alternative for the checkbox component, switch between enabled or disabled states.

Installation

yarn add @chakra-ui/switch

# or

npm i @chakra-ui/switch

Import component

import { Switch } from "@chakra-ui/switch"

Usage

<Switch />

Sizes

Pass the size prop to change the size of the switch.

<>
  <Switch size="sm" marginLeft="1rem" colorScheme="green" />

  <Switch size="md" marginLeft="1rem" colorScheme="green" />

  <Switch size="lg" marginLeft="1rem" colorScheme="green" />
</>

Switch background-color

You can change the checked background color of the switch by passing the colorScheme prop

<Switch colorScheme="blue" />

Resources

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @chakra-ui/switch

Weekly Downloads

543,241

Version

2.1.2

License

MIT

Unpacked Size

29.1 kB

Total Files

17

Last publish

Collaborators

  • segunadebayo
  • _codebender828