Select

Dropdown for choosing from a list of options. Use when there are more than 4-5 choices that would clutter the UI.

Setup

import { Select } from '@fragments-sdk/ui';

Examples

Default

Basic select dropdown

Loading preview...

With Groups

Options organized into groups

Loading preview...

With Label and Helper Text

Select with built-in label and helper text

Loading preview...

Error State

Validation error with message

Loading preview...

With Disabled Options

Some options are disabled

Loading preview...

Scrollable List

Long list with scroll hint — shows 4 items with half-peek of the 5th to indicate more

Loading preview...

Custom Max Visible Items

Show 6 items before scrolling with half-peek scroll hint

Loading preview...

Disabled

Disabled select

Loading preview...

Options Prop

Convenience API for simple lists without manual Select.Item composition

Loading preview...

Props

PropTypeDefaultDescription
childrennodeNot setSelect trigger and content
valuestringNot setControlled selected value
defaultValuestringNot setDefault selected value (uncontrolled)
onValueChangefunctionNot setCalled when selection changes
onChangefunctionNot setAlias for onValueChange
openbooleanNot setControlled open state of the dropdown
defaultOpenbooleanfalseInitial open state for uncontrolled usage
onOpenChangefunctionNot setCalled when dropdown open state changes
requiredbooleanNot setWhether a selection is required
namestringNot setForm field name
placeholderstringNot setPlaceholder text when no value selected
optionsarrayNot setConvenience options array for simple selects (alternative to compound Select.Item children)
sizeenumsmmdlgmdSize variant
classNamestringNot setWrapper class name
labelstringNot setVisible label text above the select
helperTextstringNot setHelper text shown below the select
errorunionNot setShow error styling. When a string is provided, it is displayed as an error message.
disabledbooleanfalseDisable the select

Usage Guidelines

When to use

  • Choosing from a predefined list of options
  • More than 4-5 options that would clutter UI as radio buttons
  • Space-constrained forms
  • When users need to see all options at once

When not to use

  • Very few options (2-3) - use radio buttons
  • Users might type custom values - use Combobox
  • Multiple selections needed - use Checkbox group or MultiSelect
  • Actions, not selection - use Menu

Best practices

  • Include a placeholder that explains what to select
  • Use label prop for accessible field labeling
  • Use helperText for guidance and error for validation messages
  • Group related options with SelectGroup
  • Keep option text concise
  • Order options logically (alphabetical, by frequency, or by category)
Accessibility
  • Full keyboard navigation support
  • Type-ahead search within options
  • Proper ARIA roles and attributes