Skip to content

Select

Interfaces

SelectOption<T>

Defined in: select.types.ts:9

An option for the Select component.

Type Parameters

T = any

Properties

key?

optional key: string

Defined in: select.types.ts:24

The key of the option. Must be a unique string. If none is provided, a random key will be generated. The key will be used to map the option to the select element. ⚠️ Note: If a key is generated, the original object will be mutated.

Default
crypto.randomUUID();
label

label: string

Defined in: select.types.ts:17

The label of the option.

value

value: T

Defined in: select.types.ts:13

The value of the option.


SelectProps<T>

Defined in: select.types.ts:31

The Select component properties.

Extends

  • unknown<JSX.SelectHTMLAttributes<HTMLSelectElement>>

Type Parameters

T = any

Properties

default?

optional default: string | number | SelectOption<T>

Defined in: select.types.ts:47

The option or index that is initially selected. If none is provided, the first option will be selected.

Default
undefined;
disabled?

optional disabled: boolean

Defined in: select.types.ts:67

Whether the select is disabled.

Default
false;
icon?

optional icon: string

Defined in: select.types.ts:52

An optional icon to render as part of the label.

Default
undefined;
label

label: string

Defined in: select.types.ts:36

The select label.

onChange()?

optional onChange: <T>(option, event) => void

Defined in: select.types.ts:74

Called when the selected option changes.

Type Parameters

T = unknown

Parameters
option

SelectOption<T>

The selected option

event

Event & object

The select event.

Returns

void

Default
undefined;
options

options: SelectOption<T>[]

Defined in: select.types.ts:41

An optional list of options for the select. Will be rendered into a element that is linked to the select and will be used to provide suggestions as the user types.

size?

optional size: ControlSize

Defined in: select.types.ts:57

The size of the select.

Default
undefined;
variant?

optional variant: string

Defined in: select.types.ts:62

The select variant.

Default
'contained';

Variables

Select

const Select: Component<SelectProps>

Defined in: select.component.tsx:10

A flexible select component.

Param

SelectProps

Returns

The select component.