JSPM

@chakra-ui/switch

0.0.0-dev-2022511155212
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 464833
  • Score
    100M100P100Q186982F
  • License MIT

A React component to view and switch between on or off states.

Package Exports

  • @chakra-ui/switch
  • @chakra-ui/switch/dist/chakra-ui-switch.cjs.js
  • @chakra-ui/switch/dist/chakra-ui-switch.esm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chakra-ui/switch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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