Toggle
Toggle is a component used for binary choice for a given option.
Version 1.3.2
Installation
To install @igloo-ui/toggle
in your project, you will need to run the following command using npm:
npm install @igloo-ui/toggle
If you prefer Yarn, use the following command instead:
yarn add @igloo-ui/toggle
Usage
import Toggle from '@igloo-ui/toggle';
<Toggle htmlFor="toggle-id">Label</Toggle>;
API
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode | - | The content to display inside the label |
className | string | - | Add a specific class to the toggle |
dataTest | string | - | Add a data-test tag for automated tests |
htmlFor | string | - | Indicates the ID of the element that is controlled by the toggle |
checked | boolean | - | Modifies true/false value of the toggle |
helperText | string | - | The content to display to help users |
onChange | (e: ChangeEvent<HTMLInputElement>) => void | - | Function called when the value changes |