Skip to content

Search and filtering

People look for a record by what they remember about it. Put the field beside what it searches, answer while they type, and say plainly when nothing matches.

Where search sits

Search inside a module sits above the list it filters and names that list. To search all of WerkOS, open the command palette from the header, or press Cmd+K on a Mac and Ctrl+K elsewhere.

On a phone, search takes over the header until the person taps Cancel.

Results while typing

Search from the second character, a moment after the typing stops, and keep the earlier results in view, dimmed, until the new ones arrive. The results always match what is in the field. Keep the query in the address, so a shared link opens the same results and Back returns to them.

One character: nothing changes yet

Waiting: the earlier results stay, dimmed

The answer: the new results take their place

Showing results

Put the closest match first. When results are of different kinds, group them under their names: candidates, companies, jobs.

Mark the words that matched. When the results settle, a screen reader hears how many there are.

Filters

Start broad and let people narrow. Filters sit beside the search field and apply at once.

Say what is active in words, such as Status is Offer sent, and offer one control that clears them all.

Status is Offer sent, Country is Nepal

Nothing found, slow and failed

When nothing matches, say what was searched and what to try next. A failed search is not an empty one. The earlier results stay on screen under a line that says the search did not finish, with Try again.

Nothing matches
The search failed

Keyboard

In the command palette the arrow keys move through the results, and the field tells a screen reader which result is highlighted, so the highlight is heard as well as seen.

Cmd+K or Ctrl+K
Opens the command palette
/
Moves focus to the module's search field
Up and Down arrows
Move through the results in the palette
Enter
Opens the highlighted result
Escape
Clears the query, then closes

Permitted and not permitted

Permitted

  • No candidates match “welder Kathmandu”.

    It repeats the search, and a Clear filters button offers the next step.

Not permitted

  • No results

    It says neither what was searched nor what to try.

NextNavigation

Search and filtering

Helps people find a record by what they remember, with results that follow the typing.

  • Kind: pattern
  • Page: https://design.werklist.com/patterns/search
  • Version: 2.1.2

When to use it

  • A search field above the list it filters
  • The command palette for all of WerkOS

When not to use it

  • A search field that does not name what it searches
  • Clearing the results on each key

Rules

  • Search from the second character, a moment after the typing stops.
  • The results always match what is in the field.
  • Mark the words that matched.
  • Keep the query in the address, so a shared link opens the same results and Back returns to them.
  • Put the closest match first, and group results by kind.
  • Filters sit beside the search field and apply at once. One control clears them all.
  • A failed search is not an empty one and never shows the empty state.
  • On a phone, search takes over the header until the person taps Cancel.

States

  • Idle: The placeholder names what the field searches: Search candidates
  • Typing: The search starts from the second character, a moment after the typing stops
  • Waiting: The earlier results stay in view, dimmed, until the new ones arrive
  • Results: Closest match first, grouped by kind, matched words marked
  • Nothing matches: Names the search and the next step, such as Clear filters
  • Failed: The earlier results stay under the line 'Search did not finish.' and a Try again button. The empty state does not show.

Keyboard

  • Cmd+K or Ctrl+K: Opens the command palette
  • /: Moves focus to the search field of the module
  • Up and Down arrows: Move through the results in the palette
  • Enter: Opens the highlighted result
  • Escape: Clears the query, then closes

Accessibility

  • In the command palette the field tells a screen reader which result is highlighted.
  • When the results settle, a screen reader hears how many there are.

Content

  • Nothing matches: 'No candidates match “welder Kathmandu”.' with Clear filters
  • Failed: 'Search did not finish.' with Try again
  • Active filters in words: Status is Offer sent

Tokens

  • --text-muted
  • --focus-ring

JSON

{
  "title": "Search and filtering",
  "path": "/patterns/search",
  "url": "https://design.werklist.com/patterns/search",
  "text": "https://design.werklist.com/agent/patterns/search",
  "summary": "How people find records: where search sits, how results arrive, and what an empty, slow or failed search says.",
  "version": "2.1.2",
  "kind": "pattern",
  "name": "Search and filtering",
  "purpose": "Helps people find a record by what they remember, with results that follow the typing.",
  "use": [
    "A search field above the list it filters",
    "The command palette for all of WerkOS"
  ],
  "avoid": [
    "A search field that does not name what it searches",
    "Clearing the results on each key"
  ],
  "states": [
    {
      "name": "Idle",
      "change": "The placeholder names what the field searches: Search candidates"
    },
    {
      "name": "Typing",
      "change": "The search starts from the second character, a moment after the typing stops"
    },
    {
      "name": "Waiting",
      "change": "The earlier results stay in view, dimmed, until the new ones arrive"
    },
    {
      "name": "Results",
      "change": "Closest match first, grouped by kind, matched words marked"
    },
    {
      "name": "Nothing matches",
      "change": "Names the search and the next step, such as Clear filters"
    },
    {
      "name": "Failed",
      "change": "The earlier results stay under the line 'Search did not finish.' and a Try again button. The empty state does not show."
    }
  ],
  "keys": [
    {
      "key": "Cmd+K or Ctrl+K",
      "action": "Opens the command palette"
    },
    {
      "key": "/",
      "action": "Moves focus to the search field of the module"
    },
    {
      "key": "Up and Down arrows",
      "action": "Move through the results in the palette"
    },
    {
      "key": "Enter",
      "action": "Opens the highlighted result"
    },
    {
      "key": "Escape",
      "action": "Clears the query, then closes"
    }
  ],
  "accessibility": [
    "In the command palette the field tells a screen reader which result is highlighted.",
    "When the results settle, a screen reader hears how many there are."
  ],
  "content": [
    "Nothing matches: 'No candidates match “welder Kathmandu”.' with Clear filters",
    "Failed: 'Search did not finish.' with Try again",
    "Active filters in words: Status is Offer sent"
  ],
  "rules": [
    "Search from the second character, a moment after the typing stops.",
    "The results always match what is in the field.",
    "Mark the words that matched.",
    "Keep the query in the address, so a shared link opens the same results and Back returns to them.",
    "Put the closest match first, and group results by kind.",
    "Filters sit beside the search field and apply at once. One control clears them all.",
    "A failed search is not an empty one and never shows the empty state.",
    "On a phone, search takes over the header until the person taps Cancel."
  ],
  "tokens": [
    "--text-muted",
    "--focus-ring"
  ]
}

Raw file: https://design.werklist.com/agent/patterns/search