0.4.6 • Published 4 years ago
@bdt-component-library/toggle v0.4.6
Toggle Component
About
This is a component published as its own package from our component library monorepo: https://github.com/BenefitsDataTrust/ui-components. Setup instructions, as well as higher-level goals and concerns can be found from the main project README.
Description
Handles display of toggles according to style guide.
API
| prop | type | required | default | explanation |
|---|---|---|---|---|
| className | string | no | "" | Adds an optional classname to the label |
| id | string | yes | no | Input id attr |
| testId | string | no | "" | Adds an optional data-testid for testing purposes |
| value | string | no | no | Input value |
| helperText | string | no | no | Input helper text |
| onChange | function(e: event) | no | () => {} | Event handler for onchange events |
| onClick | function(e: event) | no | () => {} | Event handler for onclick event on the toggle switch |
| inputRef | any | no | no | React ref for input |
| hasError | boolean | no | false | Determines if the input is in an error state |
| hasSuccess | boolean | no | false | Determines if the input is in a success state |
| disabled | boolean | no | false | Determines if the input is in a disabled state |
| required | boolean | no | false | Determines if the input is required |
| checked | boolean | no | false | Determines the checked status of the input |