7.1 · Forms & UI
Style the select: appearance: base-select
Style every part of a real <select> and keep its
accessibility.
appearance: base-select on both select and
::picker(select) switches the element to a fully stylable
mode. The dropdown, each option, the arrow
(::picker-icon) and the checkmark
(::checkmark) all become regular boxes.
Options can contain rich HTML like icons, and
<selectedcontent> mirrors the chosen option in the
button. Browsers without support show a normal select, so it’s safe to
add today.
// A custom dropdown component:
// a button, a listbox, keyboard support,
// ARIA roles, focus management,
// typeahead, form integration…
select,
::picker(select) {
appearance: base-select;
}
select:open::picker-icon { rotate: 180deg; }
option::checkmark { order: 1; }