JSPM

@workday/canvas-kit-react-switch

3.0.0-alpha.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q71512F
  • License Apache-2.0

A Canvas-styled switch

Package Exports

  • @workday/canvas-kit-react-switch

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 (@workday/canvas-kit-react-switch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Canvas Kit Switch

A pill shaped switch. This is an controlled input component. Undocumented props are spread to the input element.

Installation

yarn add @workday/canvas-kit-react

or

yarn add @workday/canvas-kit-react-switch

Usage

import * as React from 'react';
import {Switch} from '@workday/canvas-kit-react-switch';

<Switch disabled={false} checked={checked} onChange={this.handleCheck} />;

Static Properties

None

Component Props

Required

None

Optional

checked: boolean

Whether or not the switch is on (true) or off (false)

Default: false


disabled: boolean

Whether or not the switch is disabled (not able to be switched on or off)

Default: false


id: string

The HTML attribute id for the underlying input checkbox component.


onChange: (e: React.SyntheticEvent<HTMLInputElement>) => void

A callback that gets called everytime the switch checked state changes.


value: string

The value attribute of the input checkbox.


inputRef: React.Ref<HTMLInputElement>

A ref to the underlying input checkbox element. Use this to imperatively switch or focus this component.