Skip to content
Fleetline

Search input

Usage

Use a search input to find vehicles, work orders or parts by free text. Use filters (selects, checkboxes) when people narrow a list by known attributes, and a combobox when they must pick exactly one item from a long list.

Anatomy

  1. Landmark — <search class="search"> with a form
  2. Field — .input.input--affixed.search__box (from text field)
  3. Search icon (decorative) — .search__icon
  4. Input — input[type=search].search__control
  5. Spinner / shortcut hint — .search__spinner, kbd.search__kbd
  6. Clear button — button.search__clear[aria-label="Clear search"]
  7. Status — .search__status[role=status] (visually hidden)

Examples

Hover and focus-visible are frozen with .is-hover and .is-focus-visible, which share their rules with the real pseudo-classes.

Search input

Searching…

Press / anywhere on the page to jump here.

<search class="search" data-shortcut="/">
        <form class="search__form" action="/vehicles" method="get">
          <label class="label" for="q">Search vehicles</label>
          <div class="input input--affixed search__box">            <!-- aria-busy="true" while loading -->
            <svg class="search__icon" aria-hidden="true"><use href="#icon-search"></use></svg>
            <input class="input__control search__control" id="q" name="q" type="search" aria-keyshortcuts="/">
            <span class="search__spinner" aria-hidden="true"></span>
            <kbd class="search__kbd" aria-hidden="true">/</kbd>
            <button type="button" class="search__clear" aria-label="Clear search" hidden>…</button>
          </div>
          <p class="search__status sr-only" role="status"></p>   <!-- "Searching…", "12 vehicles found" -->
        </form>
      </search>

API

HookValuesPurpose
.searchblock class on <search>Landmark wrapper; data-enhanced once JS runs
data-shortcut="/"attributeGlobal key that focuses the field (ignored while typing elsewhere)
.search__box[aria-busy="true"]attributeLoading: spinner replaces the shortcut hint
.search__clearpartShown while filled; clears and returns focus
.search__statuspart (role=status)Polite loading/result announcements — the app writes the text
.input--sm | --lgmodifier on the boxSizes from text field
.is-hover | .is-focus-visibledocs-only classFreezes the clear button

Do and don't

Do keep a label and say in the placeholder what can be searched.
Don't drop the landmark and search type, or use a vague placeholder like "Search…".

Accessibility

Keyboard interaction
KeyBehavior
/Focuses the search field (when shortcut enabled and not typing elsewhere)
EnterSubmits the search
EscClears the field (native for type=search)
TabInput, then Clear search (when shown)

Tokens

Custom propertyPurpose
--input-*, --size-control-*Field border, height (from text field)
--color-text-mutedIcon, clear button
--color-action-ghost-bg-hoverClear button hover
--color-bg-subtle, --color-border-default, --font-family-monoShortcut hint
--color-action-primary-bg, --motion-duration-slowerSpinner