Did you know?dyk.si

Search Bar vs. Combobox vs. Command Palette

All three start as a text field with a list under it; they differ by what Enter gives you: content, a stored value, or an action.

Search Bar (Search Field)

A search bar is a fixed field in the header or above a list; you type free text, press Enter and get results from the content of the site or app.

Combobox (Autocomplete)

A combobox is a field inside a form with a suggestion list that filters as you type, and it keeps your pick as the one value the form submits.

Command Palette

A command palette is a modal dialog opened with ⌘K or Ctrl+K that lists commands and destinations rather than content, so picking one runs something or takes you somewhere.

Rule of thumb: Looking for content is a search bar, storing a value in a form field is a combobox, and running a command from the keyboard is a command palette.

When to use each one

Search Bar (Search Field)

A field with a magnifier icon where you type to find something in the site or app.

When to use it

On any site with more than a handful of pages.

Common mistake

Don’t drop the clear (×) button once there is text.

Combobox (Autocomplete)

A text field with a list of suggestions that filters as you type.

When to use it

For long lists: cities, countries, products.

Common mistake

For five options, a select or radio group is simpler.

Command Palette

A search box opened with ⌘K or Ctrl+K that reaches any command or page from the keyboard.

When to use it

For apps with many commands and keyboard-loving power users.

Common mistake

Don’t make it the only way to reach commands.

Names in code

Search BarComboboxCommand Palette
HTML/CSS<input type="search"> + role="search"role="combobox" + <datalist>role="combobox" + role="listbox"
React<Input type="search"><Command> / <Combobox><Command> — cmdk
Jetpack ComposeSearchBar / DockedSearchBarExposedDropdownMenuBoxDialog + TextField + LazyColumn
SwiftUI.searchable(text:).searchable + .searchSuggestions.searchable (custom panel)

The full guide

The difference in one paragraph

A Search Bar takes free text and gives back content: you type, press Enter, and matching pages, products or messages appear. A Combobox takes free text and gives back one value: its list is a known set, and the item you pick stays in the field for the form to submit. A Command Palette takes free text and gives back an action: it opens over the page on ⌘K or Ctrl+K, and its entries are commands and destinations, not content. What separates them is what Enter does: results load, a value is stored, or something runs.

How to tell them apart on screen

A Search Bar sits in a fixed place: the page header, or above the list it filters. It is wide, carries a magnifier icon and a clear (×) button, and rarely has a label above it. A Combobox sits inside a form among other fields, with a real label; its list is a popover the width of the field that appears only once you focus or type. A Command Palette has no resting place at all: a centred box over a dimmed backdrop, input at the top, grouped entries below, shortcuts printed on the right.

Only the Command Palette blocks the page: focus is trapped inside it and Esc closes it. On mobile a Search Bar often collapses to a magnifier icon, a Combobox must keep its list above the on-screen keyboard, and a Command Palette has no shortcut at all, so without a visible button it does not exist.

Which one to choose

Searching a help centre with 400 articles: Search Bar in the header. Put the query in the URL and keep it in the field when results load.

The city field in a booking form: Combobox. The value must match a real record, it is submitted with the form, and three letters beat scrolling 300 options.

Narrowing a visible table of 2,000 invoices as you type: Search Bar used as a filter above the table. The rows are the answer, so never force a choice from a list.

An admin dashboard the same five people use all day: Command Palette on ⌘K, with separate groups for pages, records and commands such as Invite user. Keep every command reachable from the interface too.

A shopping app's home screen on mobile: Search Bar with recent searches below it, and no Command Palette, because there is no ⌘K on a phone.

Mistakes teams make

A Search Bar built like a Combobox, where Enter does nothing until you pick a suggestion. Fix: Enter always submits the typed text, and suggestions stay shortcuts rather than a gate.

A Combobox that matches on prefix only, so typing york never finds New York. Fix: match anywhere in the string, rank exact and starts-with hits first, and show the count.

A Command Palette as the only route to a feature, with a shortcut that touch, screen reader and new users never discover. Fix: keep each command in a menu or button too, and show a ⌘K trigger in the header.

A palette shortcut that fires while the user is typing, wiping a half-written comment. Fix: ignore it when focus is in an input, textarea or editor.

Accessibility and keyboard notes

Search Bar: wrap it in a search landmark and label the input, for example Search products, visually hidden if there is no room; a placeholder is not a label. Use type="search" for the browser clear control, and announce the result count in a polite live region.

Combobox: the input carries role="combobox", aria-expanded, aria-controls and aria-autocomplete="list". Focus stays in the input while aria-activedescendant tracks the highlighted option, Enter commits it, the first Esc closes the list and the second clears the field.

Command Palette: a modal dialog with a combobox inside, so role="dialog", aria-modal="true", trapped focus, Esc to close and focus returned to where the user was. Print the shortcut beside each command, keep options 44 pixels tall for touch, and let a button open the palette too.

How to ask a coding agent for it

Name the element, then say what Enter and Esc should do. Three prompts for Claude Code and similar agents:

“Add a Search Bar to the site header: input type="search" in a search landmark, a visually hidden label, a clear (×) button while there is text, Enter goes to /search?q= and the query stays in the field.”

“Turn the city field into a Combobox with role="combobox": filter 300 cities on any part of the name, arrow keys move the highlight, Enter picks, announce the result count, reject text not in the list.”

“Add a Command Palette on ⌘K and Ctrl+K with cmdk: a modal dialog with groups for Pages, Records and Actions, shortcut hints on the right, Esc restores focus, and the shortcut ignored while focus is in a text field.”

Frequently asked questions

Is a search bar a combobox?

Usually not: a Search Bar submits whatever you typed, while a Combobox resolves your typing to one option from a known list. A Search Bar with suggestions uses the combobox ARIA pattern, but Enter must still submit the raw text.

Is a command palette just a search bar in a modal?

No. Its entries are commands and destinations rather than content, so picking one does something instead of loading results.

Does a command palette work on mobile?

Rarely on its own, because there is no ⌘K. Keep it for desktop and give phones a Search Bar plus ordinary buttons.

Do I need all three?

Most products need a Search Bar. Add a Combobox wherever a long list feeds a form field, and a Command Palette only when commands run into dozens.