Select
Select Field
NewOne select for every form: single or multiple choice, an optional search box, groups, icons and descriptions, in the library's field look.
npx motionsnack add select-fieldCustomize
<SelectField />Props
29 properties
| Property | Type | Default | Description |
|---|---|---|---|
| options | SelectFieldOption[] | 10 demo services in 3 groups | The choices: { value, label, description?, icon?, group?, disabled? }. `icon` is one of palette, layout, pen, code, shopping-cart, server, phone, search, mail, chart-column, star, user (old names cart and chart still work). |
| value | string | string[] | - | Controlled value: a string, or an array of strings with `multiple`. Leave undefined to let the component manage it. |
| defaultValue | string | string[] | - | Value on first render when uncontrolled. |
| onChange | (value: string | string[], option?: SelectFieldOption | SelectFieldOption[]) => void | - | Called with the new value and the picked option (an array of options with `multiple`). |
| open | boolean | - | Controlled open state of the list. Leave undefined to let the component manage it. |
| defaultOpen | boolean | false | Open state on first render when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | Called whenever the user opens or closes the list. |
| errorColor | string | - | Overrides the error colour on both themes (keep 4.5 : 1). Left out, the theme pair #dc2626 / #ef4444 is used. |
| name | string | - | Name submitted with a form; several values go comma-joined. |
| id | string | generated | Id of the field. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Service' | Label above the field. Empty hides it. |
| placeholder | string | 'Pick a service' | Text in the field while nothing is picked. |
| multiple | boolean | false | Pick several options; they show as chips in the field. |
| searchable | boolean | false | A search box at the top of the list that filters the options. |
| searchPlaceholder | string | 'Search services' | Hint in the search box. |
| noResultsText | string | 'No results' | Text when the search finds nothing. |
| showGroups | boolean | true | Show options under their group headings. |
| showIcons | boolean | true | Show the option icons. |
| showDescriptions | boolean | false | Show the line under each option's label. |
| clearable | boolean | false | An × in the field that clears the choice. |
| helperText | string | 'You can change it later.' | Small text under the field. Empty hides it. |
| error | string | '' | Error message. Any text marks the field invalid and replaces the helper text. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| readOnly | boolean | false | Shows the value at full contrast; focusable, but the list never opens. |
| height | number | 48 | Height of the field. With several chips it grows. |
| radius | number | 12 | Corner radius of the field. |
| listMaxHeight | number | 288 | Tallest the list gets before it scrolls. |
About Select Field
Select Field is the select a form reaches for first. Closed, it looks exactly like the library's text fields: the same height, corners, border and soft focus outline. Open, a list drops 6px below it with a short fade and settles; options can sit under small group headings, carry an icon and a line of description, and a disabled one is skipped. Switch on multiple and the picked options show as chips in the field while the list gets checkboxes; switch on search and a box at the top filters the list as you type. A clear button, helper text, a required mark and an error state that turns the border red are built in. The keyboard works as people expect from a native select, from arrow keys and Home or End to typing a letter to jump to an option, and the value is submitted with a form through a hidden input.
What's included
- Single or multiple choice with chips
- Optional search box that filters the list
- Group headings, icons and descriptions
- Full keyboard control and typeahead
- Clear button, helper text and error state
- Soft focus outline shared with every input
- Light and dark look
- Type
- Animated React select component
- Library
- Components · Select
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23