Toggle Field
Toggle Field wraps a Toggle input and its corresponding Label.
Overview
Import
Import the component from @faststore/ui
import { ToggleField } from '@faststore/ui'Import Styles into your FastStore project
To apply the styles of this component in your FastStore project, import the following into your stylesheet:
@import '@faststore/ui/src/components/molecules/ToggleField/styles.scss' @import
'@faststore/ui/src/components/molecules/Toggle/styles.scss';Follow the instructions in the Importing FastStore UI component styles tutorial.
Usage
<ToggleField id="toggle-field-example" label="Toggle Label" />Props
| Name | Type | Description | Default |
|---|---|---|---|
| testId | string | ID to find this component in testing tools (e.g.: cypress, testing library, and jest). | fs-toggle-field |
| id* | string | ID to identify input and corresponding label. | |
| label* | string | The text displayed to identify the input. | |
| displayLabel | false | true | Controls whether the label will be displayed or not. | true |
| disabled | false | true | Specifies that this input should be disabled. | |
| variant | "horizontal" | "vertical" | Controls the component's direction. | horizontal |
Customization
For further customization, you can use the following data attributes:
data-fs-toggle-field
data-fs-toggle-field-label