@k8ordo/ui

Select

A <select> for choosing one option. Pass the options to options as { value, label }.

Import

ts
import { Select } from '@k8ordo/ui';

Usage

tsx
const options = [
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana' },
  { label: 'Cherry', value: 'cherry' },
];

<Select
  id="select-basic"
  aria-describedby={undefined}
  disabled={false}
  invalid={false}
  required={false}
  options={options}
/>

Required

tsx
<Select
  id="select-required"
  aria-describedby={undefined}
  disabled={false}
  invalid={false}
  required
  options={options}
/>

Default value

tsx
<Select
  id="select-default-value"
  defaultValue="cherry"
  aria-describedby={undefined}
  disabled={false}
  invalid={false}
  required={false}
  options={options}
/>

Disabled

tsx
<Select
  id="select-disabled"
  aria-describedby={undefined}
  disabled
  invalid={false}
  required={false}
  options={options}
/>

Invalid

tsx
<Select
  id="select-invalid"
  aria-describedby={undefined}
  disabled={false}
  invalid
  required={false}
  options={options}
/>

Props

options
Type: readonly Option[]
Default: -
children?
Type: ReactNode
Default: -
invalid?
Type: boolean
Default: false
ref?
Type: Ref<HTMLSelectElement>
Default: -
PropTypeDefault
optionsreadonly Option[]-
children?ReactNode-
invalid?booleanfalse
ref?Ref<HTMLSelectElement>-

Inherited attributes (except the ones set internally): SelectHTMLAttributes<HTMLSelectElement>

k8ordo

React libraries that use Baseline features without holding back.