Components/Forms/Combobox
COMPONENT14.14

Combobox

Editable input opening a filterable listbox popover. Typing filters, arrows rove, Enter picks and fills the input.


INSTALL

1pnpm dlx @sayagodev/mo add combobox

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/combobox.css";2import "@sayagodev/mo/js/combobox.js";

Also copied as dependency: shared.css

EXAMPLES

Basic
Groups
  • Americas

  • Europe

  • Asia/Pacific
Disabled
Fully disabled
Clear
Invalid

USAGE

1<mo-combobox>2  <div data-combobox>3    <input role="combobox" aria-expanded="false" placeholder="Select…" />4    <button type="button" class="icon ghost" data-combobox-toggle></button>5  </div>6  <ul popover id="cb1" role="listbox">7    <li><button type="button" role="option" value="apple">Apple</button></li>8  </ul>9</mo-combobox>

API

NAMEKINDDESCRIPTION
<mo-combobox>elementFiltering, roving selection, placement with flip
[data-combobox]attributeInput + toggle frame
[data-combobox-empty]attributeRow shown when nothing matches the filter
mo-combobox-changeelementEvent, detail { value } on pick

FILES

src/css/combobox.csssrc/js/combobox.jsdep: src/css/shared.css
Install:mo add combobox

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--accent--accent-foreground--border--destructive--foreground--input--muted-foreground--popover--popover-foreground--radius--ring
Component hooks
--mo-combobox-height--mo-combobox-max-height--mo-combobox-min-width--mo-combobox-radius

Preview

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.