Kinetic Combobox

A searchable select: type to filter the options, move with the arrow keys and press Enter. Shows "No matches" when nothing fits.

  • <kt-kinetic-combobox>
  • Selection
  • No framework

Kinetic Combobox

The code

Copy the Kinetic Combobox

Fastest: press Copy on the card above for one complete file. To build it into your own project, use the files below: the markup, the styles, this component’s script and the shared effects script (effects.js) that every component uses.

<kt-kinetic-combobox label="Country" items="Argentina,Australia,Brazil,Canada,France,Germany,India,Japan,Mexico,Norway,Spain,United Kingdom" value="Japan" placeholder="Search countries"></kt-kinetic-combobox>

<kt-kinetic-combobox label="Assignee" items="Ada Lovelace,Grace Hopper,Alan Turing,Katherine Johnson,Linus Torvalds" placeholder="Search people"></kt-kinetic-combobox>

<kt-kinetic-combobox label="Region" items="us-east-1,us-west-2,eu-central-1,ap-south-1" value="eu-central-1" disabled></kt-kinetic-combobox>

Attributes

NameWhat it doesDefault
itemsComma separated options.—
valueThe chosen option as its text (not an index), so reordering items keeps the choice. Empty or unknown means nothing chosen.—
labelText above the field.Choose
placeholderHint shown while the field is empty.Search…
disabledPresent when the field cannot be used.—
sfxSound-effect text on choosing an option.パカッ!

Keyboard and screen readers

  • The input has role="combobox" with aria-expanded, aria-controls and aria-autocomplete="list"; the list is a listbox of options.
  • Focus stays in the input; the highlighted option is exposed with aria-activedescendant.
  • Typing filters the options and opens the list; ArrowDown and ArrowUp move the highlight (wrapping); Enter chooses it.
  • Escape closes the list and restores the chosen text; Tab or clicking away does the same.
  • A polite status announces the number of matches, or "No matches". Fires change with { value, index }.

Styling variables

Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The copied file sets them all from your choices.

FAQ

Kinetic Combobox: questions answered

How do I use the Kinetic Combobox?

Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-kinetic-combobox>.

Which attributes does <kt-kinetic-combobox> accept?

items, value, label, placeholder, disabled, sfx. Each one is described in the attributes table on this page.

Is the Kinetic Combobox accessible?

The input has role="combobox" with aria-expanded, aria-controls and aria-autocomplete="list"; the list is a listbox of options. Focus stays in the input; the highlighted option is exposed with aria-activedescendant. Typing filters the options and opens the list; ArrowDown and ArrowUp move the highlight (wrapping); Enter chooses it. Escape closes the list and restores the chosen text; Tab or clicking away does the same. A polite status announces the number of matches, or "No matches". Fires change with { value, index }.

Can I change the Kinetic Combobox colors, corners and font?

Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.