Skip to content
Statecraft

All patterns

  • Bulk Actions

    Let users perform one action across many records safely, with clear scope, eligibility and recovery.

    Data
  • Advanced Filters

    Help users narrow large datasets with filters they can see, edit, share and recover from.

    Data
  • Autosave

    Save changes continuously without a Save button, while keeping users certain their work is safe.

    Forms
  • Approval Workflow

    Route a request through one or more reviewers with clear status, accountability and an auditable history.

    Workflow
  • AI Response

    Present generated answers with streaming, sources, control and recovery, so users can trust and verify them.

    AI
  • File Upload

    Let users add files with visible progress, early validation and recovery that never loses what already uploaded.

    Files
  • Command Palette

    Give users one keyboard-first entry point to jump anywhere and run any action without hunting through menus.

    Navigation
  • Subscription Management

    Let customers upgrade, downgrade, change billing cycles and cancel with exact prices, dates and consequences shown before they confirm.

    Payments
  • Refunds

    Let support staff or customers return money with the exact amount, destination, timing and consequences stated before it's irreversible.

    Payments
  • Checkout

    Take a customer from plan choice to paid with the fewest fields, a total that never surprises, and errors that keep what they typed.

    Payments
  • Failed Payment Recovery

    Recover failed renewals with timely, specific prompts and a grace period, before customers lose access they still want.

    Payments
  • Usage & Limits

    Show customers how much of their plan they've used and handle the moment they hit a limit without breaking their work.

    Payments
  • App Sidebar

    Organise a product's main navigation so users always know where they are, reach frequent places in one click, and keep their place on small screens.

    Navigation
  • Tabs

    Split one object's content into peer views that users switch between without losing their place, state or URL.

    Navigation
  • Breadcrumbs & Back

    Show users where they are in a hierarchy and get them back to exactly where they came from — filters, scroll and all.

    Navigation
  • File Preview

    Let users look inside a file without downloading it, with a predictable fallback for every type the product can't render.

    Files
  • Attachments

    Attach files to records and comments with clear ownership, visibility and deletion rules that match the record they belong to.

    Files
  • CSV Import

    Bring spreadsheet data into the product with column mapping, row-level validation and a preview, so nothing is imported by surprise.

    Files
  • Confirmation

    Ask for confirmation only when an action is hard to undo, and make the dialog state exactly what will happen.

    Workflow
  • Partial Failure

    Report operations where some items succeed and some fail, so users know exactly what happened and what to do about the rest.

    Workflow
  • Permissions

    Show people what they can do, explain what they can't, and give them a way forward instead of a dead end.

    Workflow
  • Notifications

    Tell people about things that need them, in the right channel and at the right volume, without burying what matters.

    Workflow
  • Activity History

    Show who changed what and when on a record, in a timeline people can scan, filter and trust.

    Data
  • Empty States

    Design what users see when there's nothing to show, so every empty screen explains why and offers the next useful step.

    Data
  • Version History

    Let users see earlier versions of a document or record, compare them, and restore safely without losing current work.

    Forms
  • Human Review

    Put a person between AI output and real-world consequences, with review that's fast for good output and careful for risky output.

    AI
  • Feedback

    Collect quick, specific feedback on AI output that users actually give, and that the team can actually use.

    AI
  • Inline Validation

    Tell users about input problems at the right moment — not while they're still typing, and not only after they submit.

    Forms
  • Unsaved Changes

    Protect work in forms that save explicitly, warning only when something would actually be lost.

    Forms
  • Offline Mode

    Keep users working when the connection drops, with an honest view of what's synced, what's pending and what can't be done offline.

    Forms
  • Pagination

    Split long lists into pages or progressive loads in a way that keeps position, counts and selection predictable.

    Data
  • Saved Views

    Let users save a combination of filters, sorting and columns as a named view they and their team can return to.

    Data
  • Comments

    Let people discuss work where it happens — on the record or the exact part of it — with mentions, threads and resolution.

    Workflow
  • Error Recovery

    When something fails, say what happened in plain language, protect the user's work, and offer the most useful next step.

    Workflow
  • Keyboard Shortcuts

    Give frequent users fast keyboard paths that are discoverable, consistent and never get in the way of typing.

    Navigation
  • Prompt Input

    Design the box where users ask AI for things — with context, attachments and controls visible — so prompts start strong and never get lost.

    AI
  • AI Suggestions

    Offer AI-generated values, completions and next steps inline, so users accept good ones in one action and ignore the rest at no cost.

    AI
  • Agent Progress

    Show what an AI agent is doing during long, multi-step tasks — steps, tool use and decisions — so users can follow, steer and stop it.

    AI
  • AI Onboarding

    Introduce an AI feature by showing what it can do with the user's own data, setting honest expectations about limits and privacy.

    AI
  • Export

    Let users take their data out in the format they need, with a clear scope and no surprises about what's included.

    Files
  • Storage Limits

    Show how much storage is used and by what, and handle a full quota without blocking work or deleting anything.

    Files
NavigationFree

Command Palette

Give users one keyboard-first entry point to jump anywhere and run any action without hunting through menus.

8 states7 edge casesDesktop + Mobile

01The problem

As a product grows, its navigation and menus grow with it. Experienced users know what they want — “open the Acme account”, “create an invoice”, “switch to dark mode” — but have to click through sidebars and menus to get there. A palette solves this only if it finds the right thing in a few keystrokes.

02When to use

Use when

  • Products with many objects to jump between: projects, customers, documents
  • Frequent actions that are buried several clicks deep
  • Power users who work in the product all day
  • Products that already support keyboard shortcuts

Avoid when

  • The product has fewer than ~10 destinations; a clear sidebar is enough.
  • Users are occasional or non-technical and won't learn the shortcut — it can't replace visible navigation.
  • Only content search is needed. A search page with filters serves that better.

03Recommended UX

Statecraft recommendation

Open the palette with Cmd/Ctrl+K from anywhere, show recent items before the user types, and rank results by what the user is most likely to do — not alphabetically. Every palette action must also exist somewhere in the visible UI.

Recent items answer the most common query without typing: users mostly return to the same few places.

Ranking by intent (exact title match, then recent, then frequent, then fuzzy matches) is what makes the palette feel smart. Alphabetical lists make users read instead of act.

The palette is an accelerator, not the only way in. Hiding actions in it makes them undiscoverable for everyone who never presses Cmd+K.

04Interaction flow

  1. 01

    Anywhere in the app

    Cmd/Ctrl+K or a visible search trigger.

  2. 02

    Palette opens

    Input focused; recent items and suggested actions shown.

  3. 03

    User types

    Results update per keystroke, grouped and ranked.

  4. 04

    Arrow to a result

    Highlighted item shows its shortcut or path.

  5. 05

    Enter

    Navigate, or run the action; nested actions open a sub-step.

  6. Result

    • Navigated
    • Action done
    • No results

05Desktop behaviour

On desktop the palette is a centred overlay driven entirely by the keyboard. Mouse users should be able to use it too, but every interaction must work without one.

Desktop rules

  • Open with Cmd/Ctrl+K; close with Escape or a click outside. Never trap the user.
  • Group results by type — Recent, Pages, Customers, Actions — with groups limited to ~5 items each.
  • Show each action's keyboard shortcut on its row so the palette teaches faster paths.
  • Show a visible trigger in the header (“Search ⌘K”) so the feature can be discovered.
Grouped, ranked results with the highlight on the most likely intent, shortcuts on action rows, and unavailable actions explained.

06Mobile behaviour

Phones have no Cmd key and the on-screen keyboard covers half the screen. The palette becomes a full-screen search with large targets.

Mobile rules

  • Open from a search icon in the top bar; take the full screen.
  • Put the input at the top and keep results scrollable above the keyboard.
  • Hide keyboard shortcut hints — they're noise on touch devices.
  • Use 48px rows; tapping a row runs it directly.
Full-screen search with 48px rows and no shortcut hints. Results sit above the keyboard.

07States

  • Closed

    Visible trigger in the header with the shortcut hint.

  • Open, empty query

    Recent items and suggested actions, input focused.

  • Typing

    Ranked, grouped results update on each keystroke; first result highlighted.

  • Loading remote results

    Local results show immediately; server results join below without moving the highlight.

  • Sub-step

    An action needs input, e.g. “Assign to…” lists people. Breadcrumb shows the parent action.

  • No results

    Says what was searched and offers a fallback such as full search.

  • Action running

    For slow actions, the palette closes and progress moves to a toast.

  • Action unavailable

    Shown but disabled with a reason, e.g. lacking permission.

08Edge cases

  1. EC-01

    Results reorder while the user moves the highlight

    The user arrows to the third result just as server results arrive and shift the list.

    Recommendation

    Keep the highlighted item fixed and append remote results below local ones. Pressing Enter must run what the user saw highlighted.

  2. EC-02

    Destructive actions

    The user types “delete” and presses Enter on “Delete project”.

    Recommendation

    Never run a destructive action straight from the palette. Open the same confirmation the rest of the UI uses.

  3. EC-03

    Shortcut conflicts

    Cmd+K is also the browser's or an embedded editor's link shortcut.

    Recommendation

    Inside rich-text editors, let the editor keep Cmd+K and offer an alternative (Cmd+P or “/”). Document both.

  4. EC-04

    Permissions

    A viewer searches for “Invite member”.

    Recommendation

    Hide actions the user can never perform; show temporarily unavailable ones disabled with the reason.

  5. EC-05

    Stale recent items

    A recent item points to a project that has since been deleted.

    Recommendation

    Remove it from recents on open, or mark it “Deleted” rather than letting navigation fail.

  6. EC-06

    Typos and synonyms

    The user types “invioce” or “billing” when the page is called “Invoices”.

    Recommendation

    Use fuzzy matching and per-item keyword aliases. Synonyms are content — maintain them alongside each command.

  7. EC-07

    Large workspaces

    The workspace has 50,000 customers.

    Recommendation

    Search locally for pages and actions, query the server for records with a short debounce, and cap each group with “Show all 312 customers”.

09Microcopy

  • Placeholder

    Avoid

    “Search…”

    Prefer

    “Search or jump to…”

  • Header trigger

    Prefer

    “Search ⌘K”

  • No results

    Avoid

    “Nothing found”

    Prefer

    “No results for “acme invoce”. Search all invoices instead?”

  • Disabled action

    Avoid

    “Unavailable”

    Prefer

    “Only admins can invite members”

  • Group overflow

    Prefer

    “Show all 312 customers”

10Accessibility

  • Use the combobox pattern: the input has role="combobox", results form a listbox, and aria-activedescendant tracks the highlighted option.
  • Focus moves to the input on open and returns to the element that opened the palette on close.
  • Announce the number of results in a polite live region after typing pauses.
  • Group headings must be exposed to assistive tech, not only drawn visually.
  • The palette must never be the only route to a feature.

11Developer notes

  1. 01

    Define commands in a registry (id, title, keywords, group, shortcut, permission check, run) rather than hardcoding them in the palette component.

  2. 02

    Rank with a scoring function combining match quality, recency and frequency; store recency per user.

  3. 03

    Load the palette code lazily on first open; it isn't needed for the initial page render.

  4. 04

    Cancel stale remote searches when the query changes so older responses can't overwrite newer ones.

  5. 05

    Register the global shortcut once at the app root and ignore it while a native dialog or editor has claimed the key.

12Implementation prompt

For Claude Code, Codex or Cursor

Implement a command palette for the existing application.

Requirements:
- Global Cmd/Ctrl+K opens it; Escape and outside click close it. Also add a visible "Search ⌘K" trigger in the header.
- Combobox accessibility: role="combobox" input, listbox results, aria-activedescendant, focus returned to the trigger on close.
- Empty query shows recent items and suggested actions.
- Command registry: { id, title, keywords, group, shortcut, isAvailable(user), run }.
- Results grouped (Recent, Pages, Records, Actions), max ~5 per group with "Show all N".
- Ranking: exact/prefix title match > recent > frequent > fuzzy; support keyword aliases.
- Local results instantly; remote record search debounced, appended below, never moving the highlighted item.
- Show shortcuts on action rows (desktop only).
- Destructive actions open the standard confirmation instead of running directly.
- Hide actions the user can never perform; show temporarily unavailable ones disabled with a reason.
- No-results state names the query and offers full search.
- Mobile: full-screen search from a top-bar icon, 48px rows, no shortcut hints.
- Lazy-load the palette on first open.

Do not redesign the existing interface.
Keep commands and ranking logic separate from the palette UI.