A common form component for choosing a predefined value in a dropdown menu.
import { Select } from '@backstage/ui';
<Select
name="font"
options={[
{ value: 'sans', label: 'Sans-serif' },
{ value: 'serif', label: 'Serif' },
{ value: 'mono', label: 'Monospace' },
{ value: 'cursive', label: 'Cursive' },
]}
/>| Prop | Type | Default | Responsive |
|---|---|---|---|
| label | string | - | No |
| description | string | - | No |
| name | string | - | No |
| options | Array<{ value: string, label: string }> | - | No |
| selectionMode | singlemultiple | single | No |
| placeholder | string | Select an item | No |
| icon | ReactNode | - | No |
| value | stringstring[] | - | No |
| defaultValue | stringstring[] | - | No |
| size | smallmedium | small | Yes |
| isOpen | boolean | - | No |
| defaultOpen | boolean | - | No |
| disabledKeys | Iterable<Key> | - | No |
| isDisabled | boolean | - | No |
| isRequired | boolean | - | No |
| isInvalid | boolean | - | No |
| onOpenChange | (isOpen: boolean) => void | - | No |
| onSelectionChange | (key: Key | null) => void(keys: Selection) => void | - | No |
| searchable | boolean | false | No |
| searchPlaceholder | string | Search... | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Select component with label and description.
<Select
name="font"
label="Font Family"
description="Choose a font family for your document"
options={[ ... ]}
/>Here's a view when the selects have different sizes.
<Flex>
<Select
size="small"
label="Font family"
options={[ ... ]}
/>
<Select
size="medium"
label="Font family"
options={[ ... ]}
/>
</Flex>Here's a view when the select has an icon.
<Select
name="font"
label="Font Family"
icon={<RiCloudLine />}
options={[ ... ]}
/>Here's a view when the select is disabled.
<Select
disabled
label="Font family"
options={[ ... ]}
/>Here's a view when the select has searchable filtering.
<Select
name="country"
label="Country"
searchable
searchPlaceholder="Search countries..."
options={[
{ value: 'us', label: 'United States' },
{ value: 'ca', label: 'Canada' },
{ value: 'uk', label: 'United Kingdom' },
{ value: 'fr', label: 'France' },
{ value: 'de', label: 'Germany' },
// ... more options
]}
/>Here's a view when the select allows multiple selections.
<Select
name="options"
label="Select multiple options"
selectionMode="multiple"
options={[
{ value: 'option1', label: 'Option 1' },
{ value: 'option2', label: 'Option 2' },
{ value: 'option3', label: 'Option 3' },
{ value: 'option4', label: 'Option 4' },
]}
/>Here's a view when the select combines search and multiple selection.
Here's a view when the select is responsive.
<Select
size={{ initial: 'small', lg: 'medium' }}
label="Font family"
options={[ ... ]}
/>Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.
bui-Selectbui-Select[data-size="small"]bui-Select[data-size="medium"]bui-SelectPopoverbui-SelectTriggerbui-SelectTriggerChevronbui-SelectValuebui-SelectListbui-SelectItembui-SelectItemIndicatorbui-SelectItemLabelbui-SelectSearchWrapperbui-SelectSearchbui-SelectSearchClearbui-SelectNoResults0.9.0 - BREAKING: The SelectProps interface now accepts a generic type parameter for selection mode.Added searchable and multiple selection support to Select component. The component now accepts searchable, selectionMode, and searchPlaceholder props to enable filtering and multi-selection modes.
Migration: If you're using SelectProps type directly, update from SelectProps to SelectProps<'single' | 'multiple'>. Component usage remains backward compatible. #31649
0.9.0 - Fixed CSS issues in Select component including popover width constraints, focus outline behavior, and overflow handling. #316180.7.1 - Fix Select component to properly attach aria-label and aria-labelledby props to the rendered element for improved accessibility. #310370.7.1 - Fix Select component to properly attach aria-label and aria-labelledby props to the rendered element for improved accessibility. #310370.7.0 - Fixes some styles on the Select component in BUI. #306420.7.0 - Remove stylesheet import from Select component. #308000.7.0 - Remove stylesheet import from Select component. #308000.7.0 - Fixes some styles on the Select component in BUI. #306420.4.0 - Fix - Clicking Select label moves focus to trigger #297550.3.0 - Add Select component #294400.3.0 - Fix Select styles on small sizes + with long option names #295450.3.0 - Remove Field from TextField + Select #29482