Type to search pages and rules.

Browse pages

UI Patterns

One pattern catalog decides each recurring interface question once, such as how an expense page lays out or what an empty list shows, instead of letting each screen invent its own answer. This page states what each catalog entry holds: the options considered, the option chosen and who chose it, the narrow-screen behavior, and the implementation status per platform. Product owners and frontend teams use it when they choose and build interface behavior, so every screen answers the same question the same way instead of each route inventing its own answer.

Markdown12 provisions

Stack: any Layer: frontend-ui

Concepts#

Pattern Kinds#

A pattern answers one recurring question. Its kind states what the question is about.

KindThe question it answersExample
page-frameHow is a page of this kind laid out?An expense list page
elementHow does one control behave?Sorting on an expense table
scenarioWhat shows in this situation?An expense list with no expenses

The Catalog Entry#

The catalog is one file valid against schemas/ui-pattern-catalog.schema.json. Each pattern entry carries these fields.

FieldWhat it holds
idThe slug other records cite
groupThe group the pattern belongs to
titleThe pattern name
questionThe recurring question the pattern answers
optionsAt least two options, each with rationale and cost
decisionThe chosen option, its source, an optional note, and an optional record
compactThe breakpoint and the behavior below it
extensionsFurther options a reader may switch to
implementationsThe status and source paths per platform
libraryThe LiteSpec pattern ID the entry starts from, if any

The breakpoints map names viewport widths, and groups collect related patterns. The optional registry field names the command or path rendering every product-added option for review.

Pattern Pages#

A pattern page holds one group of patterns, such as the record-detail group in docs/frontend/patterns/record-detail.md. The patterns folder names no stack, so its pages apply to every frontend under docs/frontend/. Each ### heading under ## Patterns names one pattern, and its ID is litespec/frontend/patterns/<group>#<pattern-slug>. The heading is a name rather than an action, so the ID survives a change of default.

A pattern carries four labeled fields, then its options.

FieldWhat it holds
**Question:**The recurring question and its situation
**Default:**The option ID a project builds unless its catalog records another
**Compact:**How the default behaves on a narrow screen
**Rationale:**Why the default, the runner-up and when to prefer it, and what to leave out

Each option is a #### heading of the form #### `option-id`: Option name. It carries one wireframe block, an optional wireframe compact block for a different phone layout, then **Rationale:**, **Cost:** and an optional **Reference:**. A **Reference:** names the outside product the option learns from; references are citations, not examples, and may name real products. A **Rationale:** or **Cost:** may name that product where it states what the option learns from it. An option ID is stable once published. The page's Standards hold the rules every option keeps.

The Wireframe Language#

A wireframe states the structure of one option: which parts sit where, in what order, which action is primary, and the copy they show. It states no color, font, spacing, or component library. An agent builds the option from the text in its own stack and design system. The pattern's page on the LiteSpec site draws the text for a person to choose from.

option
Wireframe text
page
  breadcrumb "Expenses" "EXP-1042"
  header
    heading "EXP-1042"
    status "Paid" positive
    action primary "Message spender"
    menu "More"
      action "Duplicate"
      action destructive "Void expense"
  split 2:1
    region "Lines"
      table 3 "Line" "Qty" "Total"
        item: text "Rotterdam train fare" · text "2" · text "EUR 90.00"
    aside
      card "Spender"
        fact "Name" "Ava"

Each line is one part: its name, its modifiers as bare words, its copy in double quotes, then a count or a ratio. Children are indented by two spaces. A line ending in : takes inline children, which sit side by side. A middle dot, U+00B7, with a space on each side separates them. A line starting with # is a comment. Copy is the real text the product would show, drawn from the Claimwick expense product.

The parts form a closed set.

GroupParts
Structurepage, header, footer, region, aside, card, row, split, tabs, nav, breadcrumb, toolbar
Contentheading, text, fact, figure, status, message, avatar, image, icon, link, divider
Actions and inputaction, menu, field
Collectionslist, table, grid, timeline, item
Overlaysdialog, drawer, popover, toast

The modifiers belong to their parts.

PartModifiers
actionprimary, secondary, destructive, quiet, disabled
fieldtext, number, date, select, textarea, checkbox, radio, toggle, search, file, and a value after =
status, message, toastneutral, positive, caution, critical, info
headingsmall
textmuted
linkcurrent
navside
footer, toolbar, asidesticky
drawerright, left, bottom

The validator holds each block to these rules.

RuleExample
One page, at the topA block starting with header fails validation
A split holds one child per ratio partsplit 2:1 holds two children
A row holds at least two children
A list, grid, or timeline holds one template child and a countlist 3 with one item
A table names its columns and a counttable 4 "Item" "Qty"
A header, footer, toolbar, or overlay holds at most one primary action
An overlay is a child of page, after the page contentdialog last in page
A figure takes a value, a label and a value, or a label, a value, and a notefigure "Paid today" "EUR 1,240.00" "+12% on last week"
A toast holds only action children, such as Undo

On a phone the drawing reflows unless a wireframe compact block says otherwise. A row or split stacks, an aside follows the main content, a table keeps its first two columns, and a drawer rises from the bottom.

Starting a Catalog Entry from a LiteSpec Pattern#

A catalog entry may set library to one pattern ID, such as litespec/frontend/patterns/record-detail#record-header, to start from that pattern. The entry keeps the pattern's option IDs and names, so a choice stays comparable across products, and it may add options of its own.

The owner chooses among the combined options with the drawings on the pattern's page on the LiteSpec site, and records the source. The entry states the compact behavior and the implementation status per platform, and the platform team implements the chosen option in its own components. A choice that differs from the pattern's default records its reason in the entry. An agent builds the pattern Default and records it with source: recommended; it waits for an owner only when the route departs from the Default or no Default exists.

The diagram shows the flow from a LiteSpec pattern through the catalog entry that cites it to the built screen.

From a LiteSpec pattern to a catalog entry to the built screen A LiteSpec pattern with three options and a named default; a catalog entry that cites the pattern by ID and records the chosen option with source owner; and the built expense detail screen. Arrows run from the pattern to the entry to the screen. LiteSpec pattern: Record header Catalog entry: expense-header Built screen 3 options; default title-state-breadcrumb-one-primary-action litespec/frontend/patterns/record-detail#record-header Claimwick cites the pattern ID decision: the default option, source owner compact: the header stacks under the title expense detail in the web app An arrow runs from a decision to what it produces.
A LiteSpec pattern with three options and a named default, a catalog entry citing the pattern by ID with the chosen option and source owner, and the built expense detail screen, with arrows from the pattern to the entry to the screen.

The Decision Lifecycle#

A choice starts as a recommendation and settles when an owner chooses. A later change names the record that made it.

StageMeaning
recommendedThe reviewer recommendation, standing until an owner chooses
ownerThe owner choice, with an optional note
owner or recommended, plus recordA later choice, naming the decision record that made it

The Compact Variant#

Each pattern states what happens below one named breakpoint. The chosen option reflows, or a named option replaces it.

FormMeaning
reflowThe chosen option adapts to the narrow width
replacementA named option from the entry is used instead

The breakpoint names one key of the catalog breakpoints map.

Implementation Status#

Each platform entry states how far the chosen option is built there.

StatusMeaning
adoptedEvery surface follows the chosen option
partialThe shared implementation exists and some surfaces do not use it yet
pendingNo implementation exists yet
not-applicableThe platform has no such surface

A partial or pending entry states its gap in gap.

Patterns and Floorplans#

A floorplan implements the chosen option of one page-frame pattern. The pattern decides the behavior, and the floorplan is the shared component carrying it (Controlled UI Governance).

Catalog sideShared package side
A page-frame pattern and its chosen optionThe floorplan implementing that option

Every page-frame pattern therefore resolves to one floorplan, and every floorplan traces to the pattern entry that chooses it.

Standards#

Keep One Pattern Catalog#

rulerulecheckable
litespec/frontend/patterns#keep-one-pattern-catalog
Statement

A workspace with a controlled frontend MUST keep one pattern catalog at paths.uiPatterns in .litespec/project.json, valid against the schema.

Applies toartifact: any

Why

An interface decision kept in one catalog is found before it is remade: the next author reads the entry and builds the chosen option. A decision kept in chat, in a review thread, or in one author's memory is decided again on the next page, and the two answers differ. One catalog at the configured path, valid against the schema, keeps every decision searchable and every choice comparable.

Example

The project file points at the catalog.

JSON
{ "paths": { "uiPatterns": ".litespec/implementation/patterns/catalog.json" } }
Checkchecked by a tool

Checked bylitespec model check reports [litespec/frontend/patterns#keep-one-pattern-catalog] for a missing catalog, a duplicate id, an unknown group, an unknown library pattern, or a renamed option. Run it at the consumer root.

Marked checkable: the tool named here checks it.

Record Every Option Considered#

rulerulecheckable
litespec/frontend/patterns#record-every-option-considered
Statement

Each pattern MUST record at least two options with rationale and cost, and name the chosen option.

Applies toartifact: any

Why

Recording at least two options with their rationale and cost turns a preference into a decision the next team can revisit. When the chosen option stops fitting, the team reads the recorded cost of the alternative instead of repeating the research from nothing. An option recorded without its cost gives them no basis to compare.

Example

An expense list considers two sort options: clickable headers and a menu listing sort fields. The entry records the rationale and cost of each, then names the chosen one.

Checkchecked by a tool

Checked bylitespec model check reports [litespec/frontend/patterns#record-every-option-considered] for a choice or extension naming no recorded option, and the catalog schema requires at least two options with rationale and cost. Run it at the consumer root.

Marked checkable: the tool named here checks it.

Record Who Chose#

ruleruleguidance
litespec/frontend/patterns#record-who-chose
Statement

Each pattern decision MUST record its source as owner or recommended.

Applies toartifact: any

Why

The source tells the reader whether the choice is settled. A recommended choice stands until an owner confirms or changes it; an agent leaves its own choice marked as recommended, so no automated choice poses as a human decision. The catalog then shows at a glance which choices are settled and which still await review.

Example

For example, the Claimwick catalog starts its expense header entry from litespec/frontend/patterns/record-detail#record-header, keeps the pattern option IDs, and records the owner choice.

JSON
{
  "id": "expense-header",
  "group": "record-detail",
  "library": "litespec/frontend/patterns/record-detail#record-header",
  "decision": { "option": "title-state-breadcrumb-one-primary-action", "source": "owner" },
  "compact": { "breakpoint": "compact", "behavior": "The header stacks under the title." },
  "implementations": { "svelte": { "status": "adopted" } }
}

The entry names the pattern's default option and records owner as the source, so the choice stands as settled and the platform team builds it in its own components.

Checka reviewer answers

Reviewed forWhich decisions lack owner or recommended, pose an agent proposal as an owner choice, or change the choice without naming their record? Look in the catalog decisions.

Marked guidance: a reviewer answers this question.

Declare the Compact Behavior#

rulerulecheckable
litespec/frontend/patterns#declare-the-compact-behavior
Statement

Each pattern MUST name one breakpoint and state whether the chosen option reflows below it or a named option replaces it.

Applies toartifact: any

Why

A pattern with no compact statement breaks on a narrow screen, or each route redraws it for the phone in its own way and the product ships as many compact layouts as routes. Naming one breakpoint and stating whether the chosen option reflows below it or a named option replaces it settles the phone layout once. The breakpoint is a key in the catalog's breakpoints map, so every pattern measures against one width scale.

Example

The entry names breakpoint compact; below it expense rows render as cards.

Checkchecked by a tool

Checked bylitespec model check reports [litespec/frontend/patterns#declare-the-compact-behavior] for a breakpoint outside the breakpoints map or a compact option naming no recorded option. Run it at the consumer root.

Marked checkable: the tool named here checks it.

Implement a Chosen Pattern Once#

rulerulecheckable
litespec/frontend/patterns#implement-a-chosen-pattern-once
Statement

The shared UI package MUST implement each chosen pattern once at the source paths the catalog names per platform.

Applies toartifact: component

Why

The shared UI package implements each chosen pattern once, at the source paths the catalog names per platform, so every route composes the same behavior. A route that redraws the pattern instead makes a second decision the catalog does not track: it looks like the pattern, drifts from it, and no entry records the difference.

Example

The catalog names one shared source path per platform, so every expense route composes its platform path.

Checkchecked by a tool

Checked bylitespec model check reports [litespec/frontend/patterns#implement-a-chosen-pattern-once] for a named component path that does not exist or an adopted status with no components. Run it at the consumer root.

Marked checkable: the tool named here checks it.

Update the Catalog with the Code#

ruleruleguidance
litespec/frontend/patterns#update-the-catalog-with-the-code
Statement

A change that switches option, adds an option, or extends a pattern MUST update the catalog entry in the same change as its implementation.

Applies toartifact: any

Why

When the catalog waits for a later change, the code ships, the follow-up slips, and the entry describes behavior no route renders. Updating the entry in the same change as its implementation keeps the two in agreement by construction. A deliberate departure in one route names a decision record instead, so the departure stays reviewable.

Example

A route departing from the chosen option names decision.record, such as .litespec/intent/decisions/0014-expense-sort-menu.yaml.

Checka reviewer answers

Reviewed forWhich option switches, added options, or extensions land without their implementation, and which single-route departures name no decision record? Look in the change diffs and the catalog entries.

Marked guidance: a reviewer answers this question.

State the Implementation Status#

rulerulecheckable
litespec/frontend/patterns#state-the-implementation-status
Statement

Each platform entry MUST state one status and the gap when that status is partial or pending.

Applies toartifact: any

Why

The status tells a reader what is built and what is missing on each platform, so a team adopting the catalog knows which options exist in code and which are still drawings. A partial or pending entry states its gap, so the missing work is named rather than discovered. The Concepts section defines the four values.

Example

A pending entry for one platform states in gap what is missing there.

Checkchecked by a tool

Checked bylitespec model check reports [litespec/frontend/patterns#state-the-implementation-status] for a partial or pending entry with no gap. Run it at the consumer root.

Marked checkable: the tool named here checks it.

Keep the Catalog Platform Neutral#

ruleruleguidance
litespec/frontend/patterns#keep-the-catalog-platform-neutral
Statement

A pattern MUST name behavior and structure, never a component library.

Applies toartifact: any

Why

A pattern names behavior and structure: which parts sit where, in what order, with which actions. Each platform then binds that behavior to its own components through implementations, so one catalog serves every selected stack. A component library named in the pattern itself would force a second catalog per platform, and the two would diverge.

Example

An option describes a menu listing sort fields rather than naming the component rendering it.

Checka reviewer answers

Reviewed forWhich patterns name a component library outside their implementations? Look in the catalog entries outside implementations.

Marked guidance: a reviewer answers this question.

Conventions#

Keep a Visual Registry#

conventiondefaultguidance
litespec/frontend/patterns#keep-a-visual-registry
Default

Review LiteSpec options on the pattern's page on the LiteSpec site, and draw only product-specific options in a product registry at compact and full widths.

ReplacementA consumer can replace this default with an explicit local convention.

Applies toartifact: any

Why

An option seen beside its rivals is judged on appearance rather than on its description, which is how owners actually choose. The pattern's page on the LiteSpec site already draws every LiteSpec option at desktop and phone widths, so a product registry only needs to draw the patterns and options the product added, at compact and full widths. The catalog registry field names the command or path that renders them.

Checka reviewer answers

Reviewed forWhich product-added options miss the registry at compact or full widths? Look at the registry command or path the catalog names.

Marked guidance: a reviewer answers this question.

Report Pattern Feedback After the Work#

conventiondefaultguidance
litespec/frontend/patterns#report-pattern-feedback-after-the-work
Default

Finish the task on the chosen pattern, then report a proposal in the completion report with pattern id, change, reason, and affected option.

ReplacementA consumer can replace this default with an explicit local convention.

Applies toartifact: any

Why

An agent that spots a better option finishes the task on the chosen pattern first: it changes no decision on its own and stops for no mid-task question. The proposal goes in the completion report with pattern id, change, reason, and affected option, where the owner accepts, refuses, or defers it. An accepted proposal updates the catalog with its implementation under litespec/frontend/patterns#update-the-catalog-with-the-code.

Checka reviewer answers

Reviewed forWhich completion reports carry a pattern proposal without its pattern id, change, reason, or affected option? Look in the completion reports.

Marked guidance: a reviewer answers this question.

Start from a LiteSpec Pattern#

conventiondefaultguidance
litespec/frontend/patterns#start-from-a-litespec-pattern
Default

Start each catalog entry from its LiteSpec pattern, through library, and keep the pattern's option IDs, option names, and default.

ReplacementStart an entry without library and record why no LiteSpec pattern fits.

Applies toartifact: any

Why

Starting from the LiteSpec pattern keeps choices comparable across products and keeps the default visible beside the product's own options. Keeping the pattern's option IDs and names lets one product read another's catalog without translation. A product that chooses a different option records its reason in the entry, so the departure stays reviewable.

Checka reviewer answers

Reviewed forWhich entries lack library without recording why no pattern fits, or rename the pattern option ids and names? Look in the catalog entries.

Marked guidance: a reviewer answers this question.

Promote Pattern Improvements#

conventiondefaultguidance
litespec/frontend/patterns#promote-pattern-improvements
Default

Send an accepted proposal that is not specific to one product to the LiteSpec pattern page, as a new option or a refined one.

ReplacementA consumer can replace this default with an explicit local convention.

Applies toartifact: any

Why

An improvement learned in one product usually applies to every product, so keeping it local starves the shared patterns. Sending an accepted, product-neutral proposal to the LiteSpec pattern page, as a new option or a refined one, lets every later product start from it, while each product keeps its own choices. The proposal travels through litespec/frontend/patterns#report-pattern-feedback-after-the-work and reaches the pattern page after the owner accepts it.

Checka reviewer answers

Reviewed forWhich accepted product-neutral proposals never reached the LiteSpec pattern page as new or refined options? Look in the LiteSpec pattern pages and the accepted proposals.

Marked guidance: a reviewer answers this question.