Communitygithub.com

typography

Set and review how text renders - choosing typefaces, a role-based type scale as Tailwind tokens, line-height and tracking by size, measure, wrapping, truncation, tabular numbers, punctuation, font loading and size floors, on web and native. Use when picking fonts, defining a type scale, fixing text that looks off, or reviewing headings, labels, numbers and long-form text.

typography 是什么?

typography is a Claude Code agent skill that set and review how text renders - choosing typefaces, a role-based type scale as Tailwind tokens, line-height and tracking by size, measure, wrapping, truncation, tabular numbers, punctuation, font loading and size floors, on web and native. Use when picking fonts, defining a type scale, fixing text that looks off, or reviewing headings, labels, numbers and long-form text.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/manishdashsharma/ui-ux-skills/tree/HEAD/skills/typography

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

typography 是做什么的?

Typography carries the personality of a screen. Some values here are exact and missing them is a finding; tracking, pairing and scale ratios are heuristics.

Choosing faces

  • One family, or two that are clearly different (serif display + sans text, or sans + mono for figures). Two near-identical sans-serifs read as a mistake. Rarely more than three fonts; apps fewer than marketing pages.
  • Choose for the character in DESIGN.md, not the face you'd reach for on any project. Don't swap a font that's part of a real brand. Inter-by-default nobody chose may be replaced when another family fits better.
  • Native apps: the system font (SF Pro / Roboto) already ships optical sizes and tracking tables — a strong default. A custom display face for headlines and moments is fine.
  • Load every weight and style you use (next/font, @font-face, expo-font). Never let the browser synthesize bold or italic.
  • Don't propose a new typeface (paid or free) unless the task is a type change.

The scale

A small set of sizes, each paired with line-height, weight and tracking, named by role. In Tailwind v4:

@theme {
  --text-caption: 0.8125rem;   --text-caption--line-height: 1.4;
  --text-label: 0.875rem;      --text-label--line-height: 1.35;
  --text-body: 1rem;           --text-body--line-height: 1.55;
  --text-lead: 1.125rem;       --text-lead--line-height: 1.5;
  --text-title: 1.5rem;        --text-title--line-height: 1.25; --text-title--letter-spacing: -0.01em;
  --text-headline: 2.25rem;    --text-headline--line-height: 1.15; --text-headline--letter-spacing: -0.02em;
  --text-display: 3.5rem;      --text-display--line-height: 1.05; --text-display--letter-spacing: -0.025em;
}

Then text-title, text-body. Heading sizes descend with level; a subordinate heading never outweighs its parent.

Exact rules

  • Line-height by role, unitless: display ~1.05–1.1, headings 1.2–1.3, body 1.5–1.6. Anything that wraps to 3+ lines needs ≥ 1.4 — no leading-tight on card descriptions.
  • Tracking by size, in em: headings ≥ 24px get -0.01em to -0.025em; body 0; small uppercase labels (if you use them at all) +0.05em. Never negative tracking on small text.
  • Weights: below 18px use 400 or heavier. 100–300 only at 28px and up. Hierarchy from size and color first, weight second; two or three weights total.
  • Measure: cap long-form text at 60–75 characters (max-w-[65ch]).
  • Sizes: long-form body starts at 16px (rem, so user settings apply). UI text can be 14px, captions 13px, rarely below 12px.
  • Inputs on iOS web: 16px minimum or Safari zooms the page. text-base sm:text-sm, never maximum-scale=1.
  • Numbers that change (timers, counters, prices, table columns): tabular-nums. One number format across the screen.
  • Smoothing once on the root (antialiased on body), never per component.

Wrapping and truncation

  • text-balance on headings and short descriptions (not paragraphs). text-pretty on paragraphs.
  • break-words / wrap-anywhere where a URL, email or ID could escape.
  • whitespace-nowrap on badges and short labels.
  • truncate for one line, line-clamp-2/3 for previews — always with a way to the full text (tooltip, title, detail view).
  • Truncate in the middle when items differ at the end (file names, hashes). Never truncate numbers, amounts or dates.
  • Interface text is text-start; no justify.

Details

  • Store text in natural case; apply case with uppercase only if the design truly needs it. Sentence case is the default for headings, buttons and labels.
  • Typographic punctuation in rendered text: curly quotes, …, en dash for ranges (9–5), non-breaking spaces between number and unit. Code keeps straight quotes.
  • No italic for emphasis in UI; use weight or color.
  • Underlines: underline-offset-[0.2em] decoration-from-font (or tuned thickness). Dotted underline hints extra info.
  • font-variant-numeric properties, not font-feature-settings (tabular-nums, slashed-zero). font-weight: 650, not font-variation-settings. Leave optical sizing on auto.
  • In tight containers (buttons, badges), text-box: trim-both cap alphabetic as progressive enhancement fixes text sitting low.
  • Set lang and dir; wrap mixed-direction values in <bdi>.
  • Keep content selectable. select-none only on controls and drag surfaces.

Native specifics

  • Respect Dynamic Type: allowFontScaling stays on; layouts must survive 200% text. Use maxFontSizeMultiplier only on tight chrome (tab labels), never on body.
  • Never animate to a measured text height — it's wrong at a larger text size.
  • Use fontVariant: ['tabular-nums'] for timers (NativeWind tabular-nums maps to it).

Before you finish

PatternFix
font-light/font-thin under 18px400+
leading-none/leading-tight on wrapping text≥ 1.4
tracking-tight on small text, tracking in pxem, only on large text
Timer/price without tabular-numsAdd it
..., --, - ranges in UI strings…, em dash, en dash
text-balance on a paragraphtext-pretty
Input text-sm with no mobile overridetext-base sm:text-sm
ALL-CAPS tracked eyebrow above every headingRemove, or one deliberate overline

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

accessibility

Build and review interfaces against WCAG 2.2 AA - native elements first, keyboard paths, visible focus, focus trapping and restoring, hit areas, labels and forms, error announcements, accessible names, contrast thresholds, reduced motion, timers, live regions, alt text, zoom and reflow - for web (Tailwind) and React Native. Use when building any interactive UI, forms, dialogs, menus or custom widgets, or when auditing accessibility.

color-system

Build and audit color - OKLCH ramps, semantic role tokens in Tailwind, light and dark themes, one-meaning-per-color, contrast measured on the rendered pair, gradients and P3. Use when picking or generating a palette, naming color tokens, adding dark mode, fixing contrast, or when components use raw hex or bg-blue-600 directly.

create-ui

Build a complete frontend from a product description — web app, landing page, dashboard or Expo/React Native mobile app — in one consistent flow - scope screens → direction (wait for OK) → Tailwind and tokens → components → every state → motion pass → review → verify in browser or iOS simulator. Use when the user asks to build, create or design an app, site, page set or set of screens (for example "build an iOS app like X with Expo", "make a dashboard for Y", "build the frontend for this PRD").

design-direction

Decide what a product should look and feel like before building it — ground the design in the subject, write a five-line direction, plan tokens (palette, type, layout, motion), check the plan against the usual AI defaults, and lock it in DESIGN.md. Uses the user's references, design system, Mobbin/inspiration tools or theme presets when given. Use at the start of any new app, page, screen set or redesign, when the user pastes references or a design system link, asks to "match this vibe", or says the UI looks generic.

相关技能