Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Forms

Select

A native dropdown for choosing one value from a fixed list.

Selector: select[muiSelect]

Import
import { Select } from '@mushilu-san/ui/forms';
PreviewCode

Loading example…

Overview

Select is applied to a native <select>, so the browser handles keyboard and mobile pickers. It keeps the native role and all option behaviour.

As with Input, invalid also sets aria-invalid="true", so the failed choice is announced.

When to use

  • Choosing one value from a list of about 5 to 20 items.
  • Choosing a country, a category or a unit.

When not to use

  • Choosing one of two to four options that should all be visible. Use radio buttons. Use Radio instead.
  • Choosing from a long, searchable list. Use a combobox.

Examples

Sizes and variants

PreviewCode

Loading example…

Guidelines

Do

  • Put a placeholder option first, such as "Choose a country", and make it disabled.

Don't

  • Do not use a select for a list of two items. Use radio buttons.

Accessibility

Roles and attributes

ElementRoleNotes
select[muiSelect]combobox (native)invalid sets data-invalid and aria-invalid="true".

Keyboard

KeysAction
TabShiftTabMoves focus to and from the select.
Arrow keysSpaceEnterOpen the list and move through options (native behaviour).
  • Name the select with a <label> or aria-label.

API

Select

Selector: select[muiSelect]

NameTypeDefaultDescription
size'sm' | 'md' | 'lg''md' Select height and text size: `sm`, `md` or `lg`. Default `md`.
variant'ghost' | 'outline' | 'filled''outline' Visual style: `outline`, `filled` or `ghost`. Default `outline`.
invalidbooleanfalse Shows the failed-validation style and sets `data-invalid`. Also sets `aria-invalid`. Accepts attribute presence, e.g. <… invalid>.

CSS parts

  • ::part(select)

Tokens

  • --mui-color-surface
  • --mui-color-border
  • --mui-color-text
  • --mui-color-focus-ring
  • --mui-touch-target