Dropdown

ARIA
RTL

Dropdowns is a custom select component that allows users to make single or multiple selections.

An option that's been selected can represent a corresponding value in forms or be used to filter/sort content.

Based on Headless UI.

Dropdown

Anatomy

<Dropdown>
  <Dropdown.Trigger>...</Dropdown.Trigger>
  <Dropdown.Options>
    <Dropdown.Option>...</Dropdown.Option>
  </Dropdown.Options>
  <Dropdown.Hint>...</Dropdown.Hint>
</Dropdown>

Default

Trigger elements

Example layouts for options

Anatomy

<Dropdown>
  <Dropdown.Select>...</Dropdown.Select>
  <Dropdown.HiddenInput />
  <Dropdown.Options>
    <Dropdown.Option>...</Dropdown.Option>
  </Dropdown.Options>
  <Dropdown.Hint>...</Dropdown.Hint>
</Dropdown>

Select

Different states for Select

Hidden input for Select

Anatomy

<Dropdown>
  <Dropdown.InsetSelect>...</Dropdown.InsetSelect>
  <Dropdown.HiddenInput />
  <Dropdown.Options>
    <Dropdown.Option>...</Dropdown.Option>
  </Dropdown.Options>
  <Dropdown.Hint>...</Dropdown.Hint>
</Dropdown>

Select with inner label

Different states for Select with inner label

Anatomy

<Dropdown>
  <Dropdown.MultiSelect>...</Dropdown.MultiSelect>
  <Dropdown.Options>
    <Dropdown.Option>...</Dropdown.Option>
  </Dropdown.Options>
  <Dropdown.Hint>...</Dropdown.Hint>
</Dropdown>

MultiSelect

Anatomy

<Dropdown>
  <Dropdown.InsetMultiSelect>...</Dropdown.InsetMultiSelect>
  <Dropdown.Options>
    <Dropdown.Option>...</Dropdown.Option>
  </Dropdown.Options>
  <Dropdown.Hint>...</Dropdown.Hint>
</Dropdown>

MultiSelect with inner label

Dropdown

NameTypeRequiredDefaultDescription
valueTYes-The selected value.
onChange(value: T) => voidYes-The function to call when a new option is selected.
isErrorbooleanNo-Set valid/non-valid
disabledbooleanNo-Set disabled/non-disabled
sizesm | md | lg | xl | stringNomdSize
classNamestringNo-Tailwind classes for custom styles.
positiontop-start | top-end | bottom-start | bottom-end | right-start | right-end | left-start| left-end | top | bottom | right| leftNobottomSet placement for dropdown
Render Props:
openbooleanNo-Whether or not the Listbox is open.
multiplebooleanNo-Whether multiple options can be selected or not.

Dropdown.Options

NameTypeRequiredDefaultDescription
menuWidthstringNo-Tailwind class for custom options container width.
classNamestringNo-Tailwind classes for custom styles.

Dropdown.Option

NameTypeRequiredDefaultDescription
valueTNo-The option value.
Render Props:
activebooleanNo-Whether or not the option is the active/focused option.
selectedbooleanNo-Whether or not the option is the selected option.

Dropdown.Select | Dropdown.InsetSelect

NameTypeRequiredDefaultDescription
labelJSX.Element | stringNo-Label title
placeholderJSX.Element | stringNo-Placeholder
classNamestringNo-Tailwind classes for custom styles (only for button).

Dropdown.MultiSelect | Dropdown.InsetMultiSelect

NameTypeRequiredDefaultDescription
labelJSX.Element | stringNo-Label title
placeholderJSX.Element | stringNo-Placeholder
classNamestringNo-Tailwind classes for custom styles (only for button).
counterNumberNo0Number of selected options

Dropdown.HiddenInput

NameTypeRequiredDefaultDescription
namestringNo-Label title
classNamestringNo-Tailwind classes for custom styles.
valuestring | number | readonly string[] | undefinedNo_Input value