Example#
Usage#
Use a select to pick one option from a list of about five to fifteen that people already know, such as a country or a team member. It is the native element in the Input box, so phones open their own picker.
- Fewer than five options? Show them all with
RadioGroup(appearance="keys"for short ones); a select hides choices behind a click. - A long list to search? Use
Combobox. - Placeholder.
placeholderadds a hidden, disabled first option ("Choose one"), so nothing is picked by accident. - Sizes match Input:
sm40,md48 andlg56 px.
Anatomy#
- BoxThe Input box; the platform draws the list.
.mk-select - ValueThe chosen option, or the placeholder.
.mk-select-control - GlyphA turned play triangle that says it opens.
.mk-select-glyph
Volume#
Reading layer: identical at every volume.
Quiet
Studio
Press
Rave
Content#
- Options in sentence case, sorted the way people look for them: alphabetical for names, in order for sizes and dates.
- The label asks the question ("Owner"); the placeholder only says "Choose one".
- Keep options short enough to fit the box on a phone.
Do and don't#
Do
Don't
Accessibility#
- Keyboard and screen reader behaviour are the platform's.
placeholderis a disabled, hidden first option shown until a value is picked.
| Keys | What happens |
|---|---|
| Tab | Moves focus to the select |
| SpaceorEnterorAlt+Down | Opens the platform picker |
| UporDown | Changes the choice |
The colour pairs it prints, with their contrast on both papers:
| Text | Surface | Role | Bone | Night |
|---|---|---|---|---|
--mk-ink | --mk-paper | body | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper | body-ui | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper | long | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper-sunken | body | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-sunken | body-ui | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-sunken | long | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-plate | body | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink | --mk-paper-plate | body-ui | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink | --mk-paper-plate | long | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink-rule | --mk-paper | ui | 3.27:1 · Lc 56.5, passes | 3.65:1 · Lc 25.6, passes |
--mk-ink-rule | --mk-paper-sunken | ui | 3.01:1 · Lc 51.2, passes | 3.49:1 · Lc 25.2, passes |
--mk-ink-rule | --mk-paper-plate | ui | 3.65:1 · Lc 64.1, passes | 3.38:1 · Lc 24.8, passes |
--mk-on-control-2 | --mk-control | body-ui | 6.59:1 · Lc 82.6, passes | 12.47:1 · Lc 82.8, passes |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
options | readonly SelectOption[] | none | |
placeholder | string | none | A disabled, hidden first option shown until a value is picked (e.g. "Choose one"). |
size | Size | none | |
className | string | none | Lands on the box. |
style | CSSProperties | none | Lands on the box. |
children | ReactNode | none |
Tokens#
System tokens (22)
--mk-border--mk-border-thick--mk-control--mk-control-h-lg--mk-control-h-md--mk-control-h-sm--mk-control-rule--mk-disabled--mk-dur-hover--mk-ease-out--mk-focus--mk-font-text--mk-on-control--mk-on-control-2--mk-radius-control--mk-rule--mk-text--mk-text-disabled--mk-type-body-ui-leading--mk-type-body-ui-size--mk-type-body-ui-tracking--mk-type-body-ui-weight
Its own properties (4)
--mk-select-glyph-room--mk-select-h--mk-select-hatch--mk-select-pad
Changelog#
Arrived in 0.1.0.
- The reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.