Select
Glide Select
A custom select whose list springs open, with a highlight that slides between options and a check that draws itself on the chosen one.
npx motionsnack add glide-selectCustomize
<GlideSelect />Props
25 properties
| Property | Type | Default | Description |
|---|---|---|---|
| icon | ReactNode | - | Element before the value in the button, such as an icon. |
| options | { value: string; label: string }[] | 4 demo plans | Options of the list. Without a value an option uses its label as the value. |
| value | string | - | Chosen value (controlled). |
| defaultValue | string | '' | Value chosen at first render (uncontrolled). An empty string shows the placeholder. |
| onChange | (value: string, option: { value: string; label: string }) => void | - | Called with the new value and its option when the user picks one. |
| 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. |
| optionHeight | number | 40 | Deprecated: rows are 40px like every list row. Still honoured. |
| id | string | generated | Id of the button. |
| name | string | - | Name of a hidden input, so the value is sent with a form. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Plan' | Label above the select. An empty string hides it. |
| placeholder | string | 'Choose a plan' | Text in the button while nothing is chosen. |
| helperText | string | 'You can change plans at any time.' | Small text under the select. Empty hides it. |
| error | string | '' | Error message. Any text marks the select invalid and replaces the helper text. |
| height | number | 48 | Height of the select. |
| radius | number | 12 | Corner radius of the select and the list. |
| maxHeight | number | 240 | Tallest the list may get before it scrolls. |
| duration | number | 0.45 | Seconds the list takes to spring open. |
| bounce | number | 0.25 | Bounce of the springs. 0 settles without overshoot. |
| required | boolean | false | Marks the select as required. |
| disabled | boolean | false | Dims the select and blocks interaction. |
| readOnly | boolean | false | Shows the value at full contrast; focusable, but the list never opens. |
About Glide Select
Glide Select replaces the native dropdown with a button and a listbox that keep the full keyboard behaviour people expect. Closed, it matches the library's text fields: the same height, corners, border, soft focus outline, helper text and error state. The list opens from the button on a spring, its options come in one after another out of a soft blur, and it closes with a quick fade while the chevron turns over. A soft highlight glides to whichever option is hovered or reached with the arrow keys instead of jumping. The chosen option carries a black or white badge whose check mark draws in every time the list opens, and the label in the button slides up when the value changes. It works controlled or uncontrolled, takes a plain array of options and can post its value with a form through a hidden input.
What's included
- Spring-open listbox with a sliding highlight
- Options that come in one by one out of a blur
- Check mark that draws in on the chosen option
- Arrows, Home/End, Enter, Space, Escape and typeahead
- Helper text, error state and the shared focus outline
- Controlled and uncontrolled value with onChange
- Light and dark look, respects reduced motion
- Type
- Animated React select component
- Library
- Components · Select
- Stack
- Next.js, React, Tailwind CSS