Mobile UI Patterns skill for Codex

Thumb-first screens that respect the platform. Codex picks the navigation model from the number and frequency of destinations, moves primary actions into thumb reach, and sizes every target to Apple and Material minimums. On mobile web it handles safe-area insets, dvh units and keyboard overlap; on native it follows iOS and Android back, dialog and FAB conventions, and it checks screens at real phone sizes with text scaled to 200%.

  • Design & UX
  • $mobile-ui-patterns
  • 158 lines
  • 2 files
  • ~1,800 tokens
  • MIT
  • Updated

Install

curl -fsSL codexskills.dev/install.sh \  | sh -s -- mobile-ui-patterns

Installs to ~/.agents/skills/mobile-ui-patterns/ for every project on this machine.

104-line POSIX script. No sudo, no telemetry. Read install.sh

Use it in Codex

Start a prompt with $mobile-ui-patterns, or pick it from /skills. You can also just describe the task: Codex reads the description below and loads the playbook when your request matches.

What Codex reads before loading it

Designs and reviews phone interfaces for iOS, Android and mobile web - navigation model (tab bar, stack, drawer, sheets), thumb-reachable action placement, touch target sizes, safe areas and dynamic viewport units, keyboard-aware forms, gestures with visible alternatives, and platform conventions from Apple HIG and Material 3. Use when designing a mobile screen or flow, a responsive site feels bad on phones, buttons are hard to tap, content hides under the notch or keyboard, or choosing between tabs, drawer and bottom sheet.

Use it when

  • Designing or reviewing a phone screen or mobile flow
  • Choosing between tab bar, drawer, stack and bottom sheet navigation
  • Buttons are hard to tap or sit out of thumb reach
  • Content collides with the notch, home indicator or on-screen keyboard

Use something else when

  • Planning breakpoints and layouts across all screen sizes: use responsive-design
  • Writing SwiftUI view code rather than designing the pattern: use swiftui-views

How to check the result

Screens render at 320, 360 and 393 px wide with every hit area at least 44 by 44, no content under system UI with the keyboard open, and text at 200% still readable.

The mistake it prevents

Using 100vh and fixed bottom bars on mobile web, so the main button disappears behind the browser toolbar or keyboard.

~/.agents/skills/mobile-ui-patterns/SKILL.md

--- name: mobile-ui-patterns description: Designs and reviews phone interfaces for iOS, Android and mobile web - navigation model (tab bar, stack, drawer, sheets), thumb-reachable action… license: MIT ---

A good mobile screen does one primary job, puts its main action where a thumb reaches it, keeps every target at least 44 by 44 points, never hides content under system UI or the keyboard, and behaves the way the platform’s users expect.

Before designing

  1. Identify the target: native iOS (SwiftUI/UIKit), native Android (Compose), React Native/Flutter, or mobile web. Read AGENTS.md and the existing navigation code (rg -n "TabView|NavigationStack|NavigationBar|createBottomTabNavigator|BottomNavigationBar").
  2. List the top 3-5 destinations and the single most frequent action per screen.
  3. Note one-handed vs two-handed use (commuting, standing, holding something).
SituationPatternNotes
3-5 peer top-level destinations used oftenBottom tab bar (iOS TabView, M3 NavigationBar)Labels always visible; keep tab state when switching
6+ destinations or rarely used sectionsTabs for top 4 + “More”, or a drawerA drawer hides navigation; use it as secondary, not primary
Hierarchical drill-downStack navigation with backNever break system back (Android back, iOS edge swipe)
Short task off the current context (filter, share, pick)Bottom sheet, medium detentContent behind stays visible; swipe-down and a close button both dismiss
Focused multi-step task (checkout, compose)Full-screen modal with explicit Cancel/DoneConfirm discard if the user entered data
Switching views of the same dataSegmented control (iOS) or top tabsNot for navigation between unrelated sections
Single primary creation actionFAB (Android) or a toolbar/nav bar button (iOS)One FAB per screen; never for secondary actions

Reach and layout

  • Primary actions go in the bottom third: sticky bottom button bar, bottom toolbar or FAB. The top corners are the hardest reach on large phones; keep only low-frequency or destructive-adjacent actions there (Edit, Settings).
  • One primary button per screen, full-width or near it, 48-56pt tall.
  • Single-column content. Horizontal carousels hide content; use them only for browsing peers, show a partial next card as the affordance.
  • Spacing on a 4/8pt grid; 16pt side margins on phones, 20-24pt on larger phones.
  • Body text 16-17px/pt minimum; support Dynamic Type (iOS) and font scaling (Android) up to at least 200% without truncating essentials.

Touch targets

SourceMinimum
Apple HIG44 x 44 pt
Material 348 x 48 dp
WCAG 2.2 SC 2.5.8 (AA)24 x 24 CSS px, or enough spacing

Design to 44-48. The visible icon can be 24; extend the hit area with padding. Keep at least 8pt between adjacent targets. List rows are fully tappable, not just their text.

Safe areas, viewport and keyboard (mobile web)

<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
.app { min-height: 100dvh; }                  /* dvh tracks the collapsing URL bar */
.bottom-bar {
  position: sticky; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.header { padding-top: env(safe-area-inset-top); }
input, select, textarea { font-size: 16px; }  /* below 16px iOS Safari zooms on focus */
  • 100vh on mobile includes the area behind browser chrome; use dvh (or svh for layouts that must never overflow).
  • Do not disable zoom (maximum-scale=1, user-scalable=no); it is an accessibility failure.
  • Fixed bottom bars and the on-screen keyboard conflict. Prefer position: sticky in a scroll container, and test with the keyboard open on iOS Safari and Android Chrome.
  • The interactive-widget=resizes-content viewport key changes how Chromium resizes for the keyboard; Safari ignores it. Test both rather than relying on it.

Native: SwiftUI respects safe areas by default (.ignoresSafeArea() only for backgrounds); Compose needs Modifier.windowInsetsPadding(WindowInsets.safeDrawing) or Scaffold insets, and edge-to-edge is the default on recent Android targets.

Forms on phones

<input type="email" autocomplete="email" inputmode="email" enterkeyhint="next">
<input autocomplete="one-time-code" inputmode="numeric" pattern="[0-9]*">
<input type="tel" autocomplete="tel">
  • Labels above fields, never placeholder-only.
  • Right keyboard per field (inputmode, type), autocomplete for autofill.
  • Scroll the focused field into view; keep the submit button reachable above the keyboard.
  • Show errors inline under the field and keep the user’s input.

Gestures

  • Every gesture needs a visible alternative (WCAG 2.5.1 and 2.5.7): swipe-to-delete also offers a menu or edit mode; drag-to-reorder also offers move buttons.
  • Do not start custom horizontal swipes within about 20pt of the left screen edge on iOS (system back gesture) or either edge on Android (gesture navigation back).
  • Pull-to-refresh only on lists that show changing data at the top.
  • Long-press is undiscoverable; only use it for shortcuts that exist elsewhere.

Platform conventions

ElementiOSAndroid (Material 3)
BackTop-left chevron with previous title, edge swipeSystem back gesture/button; top app bar arrow
Primary createNav bar ”+” or bottom toolbarFAB
AlertsCentered alert, destructive button red, cancel boldDialog with text buttons right-aligned
Action listAction sheet / context menuBottom sheet or menu
SwitchToggleSwitch

Cross-platform apps can share structure but should use native back behaviour, dialogs and pickers on each platform.

States to design for every screen

Loading (skeleton for known layout), empty, error with retry, offline, partial data, long content (names 3x longer, 200% text), and slow network. Hand these to $ui-copy-states for wording.

Verification

  • Screens at 360 x 800 (common Android) and 393 x 852 (recent iPhone), plus 320 wide.
  • Every interactive element hit area at least 44 x 44 (check in devtools or Xcode view debugger).
  • No content under notch, home indicator or keyboard; test landscape once.
  • Text scaled to 200%: nothing essential truncated or overlapping.
  • System back works from every screen and does not lose entered data silently.
  • Primary action reachable one-handed.

For web, Playwright device emulation gives quick screenshots:

npx playwright screenshot --device="iPhone 15" http://localhost:3000/checkout iphone.png
npx playwright screenshot --device="Pixel 7" http://localhost:3000/checkout pixel.png

Emulation does not reproduce keyboard and URL-bar behaviour; confirm those on a real device or simulator.

Review output

## Mobile review: <screen>
| # | Issue | Where | Impact | Fix |
|---|---|---|---|---|
| 1 | Save button in top-right, 32pt target | Edit profile | Hard reach, mis-taps | Sticky bottom primary button, 48pt |
Platform conventions broken: <...>
Tested on: <devices/sizes, text scale, keyboard open>

Related: page-level breakpoints in $responsive-design; implementation in $swiftui-views, $android-jetpack-compose or $react-native-expo.

What the zip contains

SKILL.md plus the interface file below. Nothing runs on install.

agents/openai.yamlgenerated from this page

Gives the Codex app a display name, a one-line description and a starter prompt for this skill.

interface:
  display_name: "Mobile UI Patterns"
  short_description: "Thumb-first screens that respect the platform"
  default_prompt: "$mobile-ui-patterns Our checkout is awkward on phones, review it for thumb reach and tap targets"

About this skill

Written and maintained by the Codex Skills editors to the same editorial standard as every skill here: a selective description, a real workflow, known pitfalls and a way to verify the work. First published , last updated . MIT licensed. Something wrong or out of date? Tell us.

esc
New

Introducing Codex Skills Pro

79 professional skills that take Codex through complete engagements, each with its own scripts, references and a report that verifies the result.

All-AccessOne-time payment, no subscription
$49
Get All-AccessOr browse individual skills from $2.99 →

Secure checkout by Creem