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
FormsFree

Inline Validation

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

6 states5 edge casesDesktop + Mobile

01The problem

Validate too early and users see “Invalid email” after typing one letter. Validate too late and they submit a long form only to find six errors, some scrolled out of view. Error messages like “Invalid input” don't say what's wrong or how to fix it. Good validation is mostly about timing and wording.

02When to use

Use when

  • Any form with constraints: required fields, formats, lengths, uniqueness
  • Sign-up, checkout, settings and record creation forms

Avoid when

  • Free-form fields with no constraints.
  • Constraints that depend on several fields together — validate those on submit, at the group level.

03Recommended UX

Statecraft recommendation

Validate a field when the user leaves it, then re-validate on every keystroke once it has shown an error so the message disappears the moment it's fixed. On submit, validate everything, move focus to the first error, and show a summary for long forms. Every message says what's wrong and how to fix it.

Validating on blur waits until the user thinks they're done, so it never interrupts typing.

Switching to live validation after an error rewards the fix immediately, which is when users want feedback.

“Use at least 12 characters” is actionable. “Invalid password” makes users guess.

04Interaction flow

  1. 01

    Field untouched

    Constraints shown as helper text, not errors.

  2. 02

    User leaves field

    Validate; show error if invalid.

  3. 03

    User corrects

    Live re-validation; error clears on fix.

  4. 04

    Submit

    Validate all; focus first error; summary if long.

  5. 05

    Server validation

    Uniqueness and business rules mapped to fields.

  6. Result

    • Submitted
    • Field errors
    • Form error

05Desktop behaviour

On desktop, errors appear directly below the field, replacing or joining its helper text, with the field border changed as a secondary signal.

Desktop rules

  • Show constraints up front as helper text (“At least 12 characters”).
  • Error text below the field, in red with an icon; border colour as a secondary cue.
  • For forms longer than one screen, show an error summary at the top on submit with links to each field.
  • Never disable the submit button to signal errors — let submit reveal them.
Constraints shown up front, errors after leaving a field, and messages that say how to fix the problem.

06Mobile behaviour

On mobile, the keyboard hides much of the form, so errors must be easy to find after submit and inputs must prevent errors where possible.

Mobile rules

  • Use input types and input modes so the right keyboard appears (email, number, tel).
  • On submit, scroll the first error into view above the keyboard and focus it.
  • Keep error text short — one line where possible.
The right keyboard for each field, and the first error scrolled into view above the keyboard after submit.

07States

  • Pristine

    Helper text shows constraints; no errors.

  • Valid

    No message; optional check for fields where success isn't obvious (username available).

  • Invalid

    Error text below the field explaining the fix.

  • Checking

    Async check running (e.g. username availability).

  • Submit errors

    Summary with links; focus on first error.

  • Server error

    Form-level message when the problem isn't tied to a field.

08Edge cases

  1. EC-01

    Autofill

    The browser fills 8 fields at once.

    Recommendation

    Validate autofilled fields immediately (they won't be blurred) so problems show before submit.

  2. EC-02

    Async uniqueness check

    Checking whether a workspace URL is taken.

    Recommendation

    Debounce, show a checking state, and ignore stale responses. Re-check on submit — availability can change.

  3. EC-03

    Server rejects a value the client accepted

    The email domain is blocked by a server rule.

    Recommendation

    Map server errors back to the field with the same style, and focus it.

  4. EC-04

    Pasted values

    A phone number is pasted with spaces and brackets.

    Recommendation

    Normalise formatting instead of rejecting it. Validate meaning, not keystrokes.

  5. EC-05

    Required optional fields

    Most fields are required and marking each one adds noise.

    Recommendation

    Mark the minority: label optional fields “(optional)” when most are required.

09Microcopy

  • Password

    Avoid

    “Invalid password”

    Prefer

    “Use at least 12 characters”

  • Email

    Avoid

    “Invalid input”

    Prefer

    “Enter an email like name@company.com”

  • Uniqueness

    Avoid

    “Already exists”

    Prefer

    “lumen.yourapp.com is taken. Try lumen-team.”

  • Summary

    Prefer

    “2 fields need attention: Email, Password”

10Accessibility

  • Link errors to fields with aria-describedby and set aria-invalid="true".
  • On submit, move focus to the summary or the first invalid field.
  • Errors use text and an icon, not colour alone.
  • Don't announce errors on every keystroke — only on blur and submit.

11Developer notes

  1. 01

    Share one validation schema between client and server so rules can't drift.

  2. 02

    Track touched/dirty state per field to drive timing (blur first, then live).

  3. 03

    Return server validation errors keyed by field path.

  4. 04

    Normalise input (trim, format) before validating.

12Implementation prompt

For Claude Code, Codex or Cursor

Implement inline validation for the existing forms.

Requirements:
- Shared validation schema for client and server.
- Timing: validate on blur; once a field has an error, re-validate on each change; validate all on submit.
- Helper text shows constraints up front; error text below the field explains the fix.
- aria-invalid and aria-describedby on invalid fields; errors with icon + text.
- On submit: focus first error; error summary with links for long forms.
- Never disable submit to signal errors.
- Async checks debounced with a checking state, stale responses ignored, re-checked on submit.
- Server errors keyed by field path, rendered like client errors; form-level errors at the top.
- Autofilled fields validated immediately; pasted values normalised.
- Mobile: correct input types, scroll first error above the keyboard.

Do not redesign the existing interface.