🎉 We are thrilled to introduce FastStore v2. If you are looking for documentation of the previous version of FastStore, please refer to FastStore v1.

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

import '@faststore/ui/src/components/molecules/ToggleField/styles.scss'

Usage

<ToggleField id="toggle-field-example" label="Toggle Label" />

Props

NameTypeDescriptionDefault
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-toggle-field
id*stringID to identify input and corresponding label.
label*stringThe text displayed to identify the input.
displayLabelfalse | trueControls whether the label will be displayed or not.true
disabledfalse | trueSpecifies 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