Version 0.7.0 - Alpha
Select
component

Select

A common form component for choosing a predefined value in a dropdown menu.

Font Family

Usage

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' },
    ]}
/>

API reference

PropTypeDefaultResponsive
label
string
-No
description
string
-No
name
string
-No
options
Array<{ value: string, label: string }>
-No
placeholder
string
Select an itemNo
icon
ReactNode
-No
value
string
-No
defaultValue
string
-No
size
smallmedium
mediumYes
isOpen
boolean
-No
defaultOpen
boolean
-No
disabledKeys
string[]
-No
isDisabled
boolean
-No
isRequired
boolean
-No
isInvalid
boolean
-No
selectedKey
string
-No
defaultSelectedKey
string
-No
onOpenChange
(isOpen: boolean) => void
-No
onSelectionChange
(key: Key | null) => void
-No
className
string
-No
style
CSSProperties
-No

Examples

With Label and description

Select component with label and description.

Font Family
Choose a font family for your document
<Select
  name="font"
  label="Font Family"
  description="Choose a font family for your document"
  options={[ ... ]}
/>

Sizes

Here's a view when the selects have different sizes.

Font Family
Font Family
<Flex>
  <Select
    size="small"
    label="Font family"
    options={[ ... ]}
  />
  <Select
    size="medium"
    label="Font family"
    options={[ ... ]}
  />
</Flex>

With Icon

Here's a view when the select has an icon.

Font Family
<Select
  name="font"
  label="Font Family"
  icon={<RiCloudLine />}
  options={[ ... ]}
/>

Disabled

Here's a view when the select is disabled.

Font Family
<Select
  disabled
  label="Font family"
  options={[ ... ]}
/>

Responsive

Here's a view when the select is responsive.

<Select
  size={{ initial: 'small', lg: 'medium' }}
  label="Font family"
  options={[ ... ]}
/>

Theming

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.

Changelog