Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStoreUI componentsMolecules
Select Field

SelectField grouped a Select input and its corresponding Label.

Select Field wraps a Select input and its corresponding Label. It allows users to select one option from a set.

Overview

Example
Code

Import

Import the component from @faststore/ui

_10
import { SelectField } 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:

_10
@import '@faststore/ui/src/components/molecules/SelectField/styles.scss';

Follow the instructions in the Importing FastStore UI component styles tutorial.

Usage


_10
<SelectField
_10
id="select-order-by"
_10
label="Order by:"
_10
options={{
_10
name_asc: 'Name, A-Z',
_10
name_desc: 'Name, Z-A',
_10
top_sales: 'Top Sales',
_10
}}
_10
/>


Props

NameTypeDescriptionDefault
label*stringDefines the text displayed in the label right next to the Select.
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-select-field
id*stringAssigns an identifier to link the UISelect component and its label.
options*Record<string, string>Defines the options available in the select. The SelectOptions object keys are the property names, while the values correspond to the text that will be displayed in the UI.

Design Tokens

Local tokenDefault value/Global token linked
--fs-select-label-color
var(--fs-color-text-light)
--fs-select-label-margin-rightvar(--fs-spacing-1)

Customization

For further customization, you can use the following data attributes:
data-fs-select-field
data-fs-select-field-label
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page