Patterns

How screens are put together in each kit, and what to avoid. Generated from the kits' DESIGN_SYSTEM.md.

These are the same rules the agent reads, straight from each kit's DESIGN_SYSTEM.md.

Mobile

Patterns

Screens and layout

  • Screen skeleton: ScrollView className="bg-background flex-1" contentContainerClassName="gap-5 p-5 pb-32" → sections (SectionHeader + Card of ListRows) → StickyBottomBar after the ScrollView when there is a primary action. Why: every screen scrolls the same way, its last row clears the bottom bar, and the screens read as one app. Break it only for a screen that doesn't scroll by nature: a camera or scanner, a chat with its composer pinned, a SuccessScreen.
  • A title sits on the thing it names. A group of rows takes its title above it, outside the card (SectionHeader, or ListGroup's title). A card that is one thing (a chart, a form, a plan) takes its title at its top, inside. Never both on one group. Why: a title above a list names the whole group and leaves the card to its rows; a chart or a form is one object, and its title travels with it. There is no exception.
  • One surface per group: never a card inside a card. Rows inside a card are ListRows, divided by the list, or a Separator. Why: a card says "this is one group". A second card inside adds an edge and padding without a second meaning. There is no exception.
  • Items of one kind are a list; cards are for mixed things. Records people scan, search or compare (orders, people, transactions) are a ListGroup. Cards hold different things side by side (a chart, a KPI, a list). Why: a list keeps each field in the same place, so the eye runs down a column. Cards move the fields, take more room and hide the order. Break it only for things people choose by looking (products, photos, places): a grid of ImageTiles.
  • Left-align text, empty and success states included (EmptyState and SuccessScreen do). Why: every line starts at the same edge, so the eye finds the next line and the next block without searching. Break it only for a figure or a label alone in a small space (a key on the NumericKeypad, the value in a ProgressRing).
  • Overlays are for short, scoped tasks: confirming, picking one of many, a short edit form. Secondary content goes on the screen or its own route, one overlay at a time, each with a way out. Why: an overlay stops the task and hides what the person may need to answer it. There is no exception.
  • Pickers: OptionSheet on phones; Select when the list is short and the field sits in a form. Why: a sheet is in thumb reach and has room for a long list; a Select's menu suits a short list beside other fields. There is no exception.
  • Tracking: what already happened and what comes next (an order, a delivery, an application) is a Timeline in a Card. Stepper is for a flow the person is filling in. Why: a Stepper shows where the person is in something they are doing; a Timeline records events they don't control. There is no exception.

Actions

  • One primary action in view. Everything else is secondary, outline or ghost. Why: the filled button is where the eye goes first; two of them compete, and the person has to work out which is the next step. Break it only for an overlay, which has its own primary, and several empty states shown at once, whose actions drop to secondary.
  • A button names its action ("Delete 3 photos", "Pay £40"), never "OK" or "Submit" on something with a consequence. Why: people read the button, not the sentence above it, and a generic label hides what happens. Break it only for the standard words (Done, Cancel, Close, Back), and OK on an alert that only informs.
  • The cost of a mistake sets the friction. Reversible: do it, and offer Undo in a toast. Irreversible or costly: an AlertDialog that names the thing and the effect, its button naming the action, Cancel never the default. Moving money or deleting for good: SwipeToConfirm. Why: a confirmation people see on every tap gets tapped through, so it is kept for what can't be taken back. There is no exception.
  • States only on what acts: a pressed look (active:bg-accent, a dimmed row) goes only on something with an onPress: a Button, a ListRow with onPress, a card that opens. In the web build the same goes for hover. Why: a state is a promise that something happens. A row that reacts and does nothing reads as broken, and an agent or a tester reading the screen will try to tap it. When a whole row or card acts, the state goes on that one element, never on its parts as well. There is no exception: read-only content never reacts.
  • Prefer an enabled button that says what's missing over a disabled one. When something is disabled, it is the theme's 50%, never restyled. Why: a disabled control can't say why it is off, and its contrast is exempt from WCAG, so some people can't read it. Break it only for an action in progress: disabled with a Spinner, so it can't be sent twice.
  • Forms: a Label for every field, errors next to the field (aria-invalid and a text-destructive line under it), and the button names the action. Why: the Label is the field's name for a screen reader, and an error beside its field says where to fix it. There is no exception.
  • Asking for a rating: after the thing is done (an order delivered), as an input Rating in its own Card with a toast to thank them. Show a score as a display Rating with the number. Why: asked mid-task, it interrupts, and the answer is about the interruption. There is no exception.

Feedback

  • A finished task ends on SuccessScreen; a single action gets a toast. An order, a payment or a sign-up ends on the success screen, with what happens next and a StickyBottomBar with "Done". A saved setting or an archived item gets a toast. Why: a task the person worked through needs a clear end and a receipt; a small action only needs a nod, without leaving the screen. There is no exception.
  • A toast confirms; it never carries what someone must not miss. An error that needs action goes next to its field or in an Alert. Why: a toast leaves on a timer, and anyone looking away, or on a screen reader, can miss it. There is no exception.
  • Anything that can be empty has an EmptyState with the next step. Why: a blank area reads as broken or still loading; the empty state says what goes there and how to start. Break it only for a space with no next step: a search with no results says so, with a way to clear it.
  • Loading: Skeleton for content, Spinner inside a button (tone="button-foreground" on the primary one), Progress when you know how far. Why: a skeleton shows what is coming and keeps the layout from jumping; a spinner in a button ties the wait to that action. Break it only for a wait under a second, which shows nothing.
  • Shadow only on what presses or floats (dialogs, sheets, menus, toasts, the FloatingButton). Content is flat, and so are fields, which are neither. Why: a shadow reads as "this lifts off the page", so on static content it promises something that isn't there. Break it only through the theme: a system may give its fields a shadow in Studio. Never add one by hand.
  • Permission: PermissionPrimer before the OS dialog, always with a skip that runs the simulated path. Never show a raw denied state. Keep its copy in step with the strings in app.json. Why: the primer and the OS dialog saying the same thing is what earns the grant, and the skip means a prototype never dead-ends on a permission the viewer declined. There is no exception.

Motion and access

  • Motion: anything that slides, springs or moves calls useMotion() / useReducedMotion() from lib/reduced-motion.ts and collapses to 0 ms when the OS asks. Why: the setting is there for people whom motion makes dizzy. components/ui gets it from reanimated's ReduceMotion.System, but the kit's Animated code has no equivalent, so each component has to ask. There is no exception: a new animated component without it is a bug.
  • Every control has a name. A Switch, RadioGroupItem or Checkbox needs a Label htmlFor its id, or an aria-label (a Switch at the end of a ListRow); an icon-only button needs an accessibilityLabel. Why: a screen reader announces the name and nothing else. There is no exception.
  • State goes in the aria-* props (aria-checked, aria-selected, aria-valuenow), not accessibilityState / accessibilityValue. Why: the web export drops the accessibility* props, and native reads aria-* too. Break it only for a selected button (chip, segment, day), which keeps accessibilityState={{ selected }} for native and adds aria-pressed for web.
  • One group picks one or picks any, never both. Radios and checkboxes go in separate groups. Why: they look alike, and mixed in one group people can't tell which choices exclude each other. There is no exception.

Anti-patterns

A last look before saying done. Each one breaks a rule above, which says why.

  • ✗ A card inside a card. ✗ A section title inside a card of rows. ✗ Centred blocks of text.
  • ✗ Cards for a list of like items. ✗ The same padding on every element.
  • ✗ Radio and checkbox choices in one group.
  • ✗ An overlay as the default home for secondary content.
  • ✗ Brand colour put on selected chips or tabs by hand. ✗ Colour as the only signal. ✗ Grey-on-grey text below 4.5:1.
  • ✗ A pressed look on something that does nothing when tapped.
  • ✗ Two primary buttons in view. ✗ "OK" or "Submit" on an action with a consequence.
  • ✗ A confirmation dialog for something Undo could take back.
  • ✗ Tap targets under 44×44. ✗ A control without a name.
  • ✗ A toast carrying an error someone must act on. ✗ A blank list.

Web

Patterns

Pages and layout

  • App page: AppShell in the prototype's layout.tsx → PageHeader → 2–4 StatTiles → Cards or a DataTable. The page's primary action sits in the PageHeader. Why: every app page has the same shape, so a viewer finds the title, the numbers and the detail in the same places. Break it only for a page that is one tool (an editor, a map, a conversation): AppShell and PageHeader, then the tool.
  • Marketing page: Hero → FeatureGrid → social proof or a product shot → PricingCards → FAQ (Accordion) → a closing call to action. One promise, one primary action, repeated at the end. Why: a visitor decides in seconds; one promise and one action keep the decision simple, and the repeat catches those who read on. There is no exception.
  • AI conversation: ChatMessages in a centred column (max-w-3xl), ChatComposer pinned at the bottom. Show work as it happens (ThinkingIndicator, ToolCallCard), stream the answer (StreamingText), and ask with an ApprovalCard before anything irreversible or costly (consent before consequence). Past conversations go in a ChatThreadList: a sidebar on desktop, a Sheet on small screens. When the assistant can use files, give ChatComposer an accept; sent files show as AttachmentChips in the user's turn. An answer built on the person's data or documents cites them (CitedText + SourceList); the latest answer can end with FollowUpSuggestions. A cancelled tool call is stopped, not error. Why: the person can't see the model work. Showing each step, citing what an answer rests on and asking before acting keep them in charge and let them stop it. There is no exception.
  • Responsive: design at 375px and 1280px. Sidebars collapse into a sheet (AppShell does), tables scroll inside their card, grids drop columns. Why: 375 and 1280 are the narrow phone and the common laptop, the two ends a prototype is shown on, and qc:look checks both. There is no exception.
  • A title sits on the thing it names. A group of rows takes its title above it, outside the card (SectionHeader, or ListGroup's title). A card that is one thing (a chart, a form, a plan) takes its title at its top, inside (CardHeader). Never both on one group. Why: a title above a list names the whole group and leaves the card to its rows; a chart or a form is one object, and its title travels with it. There is no exception.
  • One surface per group: never a card inside a card. Rows inside a card are ListRows, divided by the list, or a Separator. Why: a card says "this is one group". A second card inside adds an edge and padding without a second meaning. There is no exception.
  • Items of one kind are a list; cards are for mixed things. Records people scan, search or compare (orders, people, invoices) are a ListGroup or a DataTable. Cards hold different things side by side (a dashboard: a chart, a KPI, a list). Why: a list keeps each field in the same place, so the eye runs down a column. Cards move the fields, take more room and hide the order. Break it only for things people choose by looking (products, photos, places): a grid of ImageTiles. A marketing page's FeatureGrid holds 3–6 points that differ, not one point repeated.
  • Left-align text, empty and success states included (EmptyState and SuccessScreen do). Why: every line starts at the same edge, so the eye finds the next line and the next block without searching. Break it only for a marketing Hero without media (one line and one button), and a figure or a label alone in a small space.
  • Overlays are for short, scoped tasks: confirming, picking, a short edit form (Dialog), a record's details or filters (Sheet). Secondary content goes on the page or its own route, one overlay at a time, each with a way out. Why: an overlay stops the task, hides what the person may need to answer it, and can't be linked or scrolled with the page. There is no exception.

Actions

  • One primary action in view. Everything else is secondary, outline or ghost. Why: the filled button is where the eye goes first; two of them compete, and the person has to work out which is the next step. Break it only for an overlay, which has its own primary, and several empty states shown at once, whose actions drop to secondary.
  • A button names its action ("Delete 3 invoices", "Send invite"), never "OK" or "Submit" on something with a consequence. Why: people read the button, not the sentence above it, and a generic label hides what happens. Break it only for the standard words (Done, Cancel, Close, Back), and OK on an alert that only informs.
  • The cost of a mistake sets the friction. Reversible: do it, and offer Undo in a toast(). Irreversible or costly: an AlertDialog that names the thing and the effect, its button naming the action, Cancel never the default. Why: a confirmation people see on every click gets clicked through, so it is kept for what can't be taken back. There is no exception.
  • States only on what acts: a hover or pressed look (hover:bg-accent, active:bg-*, a shadow that lifts, cursor-pointer) goes only on an element that does something when clicked: a Button, a link, a ListRow with href or onClick, a card that opens. Why: a state is a promise that something happens. A row that lights up and does nothing reads as broken, and an agent or a tester reading the page will try to click it. When a whole row or card acts, the state goes on that one element, never on its parts as well. There is no exception: a read-only table row doesn't hover (the kit's TableRow doesn't; give a clickable row hover:bg-muted and a link).
  • Prefer an enabled button that says what's missing over a disabled one. When something is disabled, it is the theme's 50%, never restyled. Why: a disabled control can't say why it is off, and its contrast is exempt from WCAG, so some people can't read it. Break it only for an action in progress: disabled with a Spinner, so it can't be sent twice.
  • Forms: a Label for every field, DatePicker for a single date, errors next to the field (aria-invalid and a text-destructive line), and the submit button names the action. Why: the Label is the field's name for a screen reader and a bigger click target, and an error beside its field says where to fix it. There is no exception.

Feedback

  • A finished task ends on SuccessScreen; a single action gets a toast. An order, a payment or a sign-up ends on the success screen, with what happens next and a "Done". A saved setting or an archived row gets a toast(). Why: a task the person worked through needs a clear end and a receipt; a small action only needs a nod, without leaving the page. There is no exception.
  • A toast confirms; it never carries what someone must not miss. An error that needs action goes next to its field or in an Alert. Why: a toast leaves on a timer, and anyone looking away, or on a screen reader, can miss it. There is no exception.
  • Anything that can be empty has an EmptyState with the next step. Why: a blank area reads as broken or still loading; the empty state says what goes there and how to start. Break it only for a space with no next step: a filtered table with no matches says so, with a way to clear the filter.
  • Loading: Skeleton for content, Spinner inside a button (tone="button-foreground" on the primary one), Progress when you know how far. Why: a skeleton shows what is coming and keeps the layout from jumping; a spinner in a button ties the wait to that action. Break it only for a wait under a second, which shows nothing.
  • Shadow only on what presses or floats (dialogs, popovers, menus, toasts). Content is flat, and so are fields, which are neither. Why: a shadow reads as "this lifts off the page", so on static content it promises something that isn't there. Break it only through the theme: a system may give its fields a shadow in Studio. Never add one by hand.

Access

  • Every control has a name. A field has its Label, a Switch, Checkbox or radio a Label htmlFor its id or an aria-label, an icon-only button an aria-label. Why: a screen reader announces the name and nothing else. There is no exception.
  • One group picks one or picks any, never both. Radios and checkboxes go in separate groups. Why: they look alike, and mixed in one group people can't tell which choices exclude each other. There is no exception.

Worked examples of the first three: /dashboard (an AppShell app with a chart, a filtered table, a dialog form, settings and a guarded delete), /landing and /assistant.

Anti-patterns

A last look before saying done. Each one breaks a rule above, which says why.

  • ✗ A card inside a card. ✗ A section title inside a card of rows. ✗ Centred blocks of text.
  • ✗ Cards for a list of like items. ✗ The same padding on every element.
  • ✗ Radio and checkbox choices in one group.
  • ✗ An overlay as the default home for secondary content.
  • ✗ Brand colour put on selected tabs, chips or nav items by hand. ✗ Colour as the only signal. ✗ Grey-on-grey text below 4.5:1.
  • ✗ A hover or pressed look on something that does nothing when clicked.
  • ✗ Two primary buttons in view. ✗ "OK" or "Submit" on an action with a consequence.
  • ✗ A confirmation dialog for something Undo could take back.
  • ✗ Icon-only buttons without aria-label. ✗ A control without a name.
  • ✗ A toast carrying an error someone must act on. ✗ A blank list or table.
  • ✗ An assistant that acts without asking, or hides what it did.

The hallucination guard

  • Before writing JSX, list the components you intend to use. Every name must appear in the registry above exactly. If you need something else: stop, describe the gap in one line, and use the add-component skill. Do not import from react-native-paper, @expo/vector-icons, gluestack or any UI library that is not in package.json. Why: a name that isn't in the registry is a guess; it either fails to import or produces a look-alike outside the theme that nobody maintains. There is no exception.
  • npm run lint enforces this: an import from components/ui or components/kit that the registry doesn't list, another UI library, or Text / TextInput / Pressable from react-native in a screen is an error (halftone/* rules). Break it only with // eslint-disable-next-line <rule> -- <reason>, the reason saying why the kit can't do it (for example, a whole product card that is one tap target).

On this page