Documentation
Form Components
Select

Select

The Select component provides a versatile and user-friendly dropdown menu for selecting a single option from a list.

Installation

Install the package

npm i @start-base/react-form-elements

Add the styles

To use the React form elements styles in a Next.js project, import the styles in your layout.tsx file.

app/layout.tsx
import "@start-base/react-form-elements/styles.css";

Import the component

import Select from '@start-base/react-form-elements/Select';

Usages

Select With Label

Select With Placeholder

Placeholder

Select With Placeholder And Label

Placeholder

Select With Placeholder And Label And Disable Shrink

Placeholder

Select Disabled

Placeholder

Select Multiple

Placeholder

Select Error

Error Message

API

This component is a wrapper around react-select (opens in a new tab) component. All props from react-select API Reference (opens in a new tab) can be passed to this component.

NameTypeDefaultDescription
namestringName of the input
labelstringnullLabel of the input
placeholderstringnullPlaceholder of the input
disableShrinkbooleanfalsePosition the label outside of the input
valueobject or arrayValue of the input
onChangefunctionCallback function that is fired when the value changes.
inputClassNamestringnullClassname for input element
labelClassNamestringnullClassname for label element
errorClassNamestringnullClassname for error element
disabledbooleanfalseDisable the input
errorstring or boolean or objectnullError message to display below the input. if value is a boolean input border will be change. Also you can pass schema validator error objects.
optionsarray[]Array of options to display
classNamesobjectnullClassNames object for select components
componentsobjectnullComponents object for select

Styling