1.34.0 • Published 4 days ago

@s-ui/react-atom-switch v1.34.0

Weekly downloads
934
License
MIT
Repository
-
Last release
4 days ago

AtomSwitch

Description

The switch is the radio button when there’re only 2 exclusive options. “On/off” is a common and clear example for explaining this component.

In order to collect the result of this switch there is a callback onToggle, this callback receives a flag on true if select is active. If you're using a select type of this component, false means the first option and true the second one.

There are several two sizes for this component: default and large.

Installation

$ npm install @s-ui/react-atom-switch --save

Usage

Basic usage - Uncontrolled component

import AtomSwitch from '@s-ui/react-atom-switch'

return (
  <AtomSwitch
    disabled={false}
    initialValue={false}
    isFitted={false}
    isLoading={true}
    label="Label"
    labelLeft="Off"
    labelOptionalText="Optional label"
    labelRight="On"
    onToggle={flag => console.log(`Switch value is ${flag}`)}
    size="default"
    type="toggle"
  />
)

Basic usage - Controlled component

import AtomSwitch from '@s-ui/react-atom-switch'

return (
  <AtomSwitch
    labelLeft="Off"
    labelRight="On"
    onToggle={value => handleChangeFromParent(value)}
    type="toggle"
    value={value}
  />
)

Find full description and more examples in the demo page.

1.34.0

4 days ago

1.33.0

3 months ago

1.32.0

3 months ago

1.31.0

3 months ago

1.30.0

12 months ago

1.29.0-beta.0

1 year ago

1.29.0

1 year ago

1.28.0

2 years ago

1.27.0

2 years ago

1.25.0

2 years ago

1.26.0

2 years ago

1.23.0

2 years ago

1.24.0

2 years ago

1.22.0

2 years ago

1.21.0

2 years ago

1.20.0

3 years ago

1.19.0

3 years ago

1.18.0

3 years ago

1.17.0

3 years ago

1.16.0

3 years ago

1.15.0

3 years ago

1.14.0

3 years ago

1.13.0

3 years ago

1.12.0

3 years ago

1.11.0

3 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

5 years ago

1.6.0-beta.1

5 years ago

1.6.0-beta

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago