Skip to main content
The Select component provides a searchable dropdown for selecting a single option from a list with support for custom rendering and async data.

Basic usage

<flx-select
  label="Country"
  placeholder="Select a country"
  [(ngModel)]="selectedCountry"
  [options]="countries">
</flx-select>

Properties

label
string
Label text displayed above the select
placeholder
string
Placeholder text when no option is selected
value
any
Currently selected value
options
SelectOption[]
required
Array of options to display. Each option should have value and label properties
disabled
boolean
default:"false"
Disables the select
required
boolean
default:"false"
Marks the field as required
error
boolean | string
default:"false"
Shows error state. Pass a string to display error message
searchable
boolean
default:"true"
Enables search/filter functionality
clearable
boolean
default:"false"
Shows clear button when option is selected
loading
boolean
default:"false"
Shows loading spinner
helperText
string
Helper text displayed below the select

Events

valueChange
EventEmitter<any>
Emitted when the selected value changes
Emitted when user types in search box

Examples

<flx-select
  label="Status"
  placeholder="Select status"
  [(ngModel)]="status"
  [options]="statusOptions">
</flx-select>
export class StatusSelect {
  status = 'active';
  statusOptions = [
    { value: 'active', label: 'Active' },
    { value: 'inactive', label: 'Inactive' },
    { value: 'pending', label: 'Pending' },
    { value: 'archived', label: 'Archived' }
  ];
}

Styling

flx-select {
  --flx-select-height: 40px;
  --flx-select-border-radius: 4px;
  --flx-select-border-color: #d1d5db;
  --flx-select-focus-border-color: #3b82f6;
  --flx-select-error-border-color: #ef4444;
  --flx-select-background: #ffffff;
  --flx-select-dropdown-max-height: 300px;
  --flx-select-option-padding: 8px 12px;
  --flx-select-option-hover-background: #f3f4f6;
  --flx-select-option-selected-background: #dbeafe;
}

Accessibility

The Select component is fully accessible:
  • Keyboard navigation (Arrow keys, Enter, Escape)
  • role="combobox" with proper ARIA attributes
  • aria-expanded, aria-activedescendant for dropdown state
  • Screen reader announcements for selection changes
  • Focus management

Best practices

  • Use searchable select for lists with more than 10 options
  • Provide clear labels and placeholder text
  • Enable clearable for optional fields
  • Use async loading for large datasets
  • Group related options when appropriate
  • Consider MultiSelect for multiple selections

Build docs developers (and LLMs) love