Skip to content

feat(core): use typography roles in components - #628

Merged
wemra3 merged 12 commits into
mainfrom
feat/typography-roles-in-components
Oct 23, 2026
Merged

wemra3 merged 12 commits into
mainfrom
feat/typography-roles-in-components

Conversation

@wemra3

@wemra3 wemra3 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

The third change for tailor-inc/platform-planning#1580. #572 added the typography roles and #594 added Text; this PR uses them in AppShell's own components. Core components had 231 raw size classes and no roles.

Design Decision

Content text (titles, descriptions, captions, messages, key and value display) renders with Text. Controls (buttons, inputs, menu items, badges, table cells), cva strings, and containers use the role class.

Base UI parts are passed with render, and the existing data-slot stays on the render element. Element types do not change.

Summary

  • Replace all 231 raw size classes: Text in 78 places, the role class in 153. The visual changes are listed in the changeset (text below 12px moves to 12px, section labels move to weight 500, selected items move to font-semibold, and a few line heights move to the role).
  • Text passes children only when given, so Field.Error inside Text keeps its validation message.
  • Add tests/typography-usage.test.ts, which fails on a raw size or an unknown role name.
  • Update the decision record, the component rules, and the styling docs.

Computed text styles match main on all 33 example routes and in 184 opened popups, except for the listed changes.

Screenshots

Left: main. Right: this PR.

Text below 12px moves to 12px

Section labels move to weight 500

Line heights move to the role

Key and value: key 500, value 400

Heading elements and Alert.Title

A selected item uses weight 600

🤖 Generated with Claude Code

Hiroki Uemura and others added 11 commits October 20, 2026 21:00
Value-identical swaps for 209 places, plus the decisions agreed on
2026-10-18/19: text below 12px moves to 12px, line heights outside the
allowed modifiers move to the role, and the section labels (chat history,
tool, filter rail legend, ActivityCard day label, Menu group label) use
label-sm at weight 500. code-sm adds 2px of line height (16 to 18px).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Titles, descriptions, captions, messages, error text and key/value
display in core components now use Text. Controls, cva strings and
containers keep the role class. Base UI parts and elements that differ
from the role's default tag are passed with render; the existing
data-slot moves to the render element.

Text now passes children only when given, so a render part that
supplies its own content (Base UI Field.Error with the validation
message) keeps it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l-sm

The indicator inherited weight 500 from the column header. body-sm set 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alue pairs

DescriptionCard values 500 -> 400; AppInfo, DocumentProgressCard and
CsvImporter summary keys 400 -> 500; CsvImporter summary values 500 -> 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ebar app title

Both are h3/h1 elements. Empty state title 500 -> 600, sidebar app title
400 -> 600 (the same as the GlobalHeader title).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…no size

Alert.Title renders with Text label-md and drops tracking-tight
(-0.025em -> 0). Table head and footer cells, the CsvImporter table head,
the tool name and the DataTable filter chip field and value take label
roles; their values do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Emphasis uses font-semibold only, so the selected item moves from 500 to
600 with its background, as Primer NavList/ActionList and Polaris
Navigation do (chat history, DataTable filter panel, sidebar).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aw sizes

The decision record gets a third-change section, the component rules say
when to render Text and when to use the role utility, and the styling and
Text docs drop "figures in a table" from label-md and pair numbers with
body-md. tests/typography-usage.test.ts fails on a raw text size, an
unknown role name, or text-code-sm without font-mono.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e heights to roles

Review follow-up. DescriptionCard and CsvImporter values render span as
before (body-md defaults to p). Alert.Description paragraphs use
body-md-relaxed instead of leading-relaxed, and the chain-of-thought step
label uses Text. The guard test also rejects line heights outside the
roles, and a DescriptionCard test checks the value elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Text children fix

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wemra3
wemra3 requested a review from a team as a code owner October 21, 2026 00:12
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (b0fd352) #628 (c61a473) +/-
Coverage 89.3% 89.3% +0.0%
Test Execution Time 2m31s 2m40s +9s
Details
  |                     | main (b0fd352) | #628 (c61a473) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          89.3% |          89.3% | +0.0% |
  |   Files             |            227 |            227 |     0 |
  |   Lines             |           7240 |           7240 |     0 |
+ |   Covered           |           6469 |           6470 |    +1 |
- | Test Execution Time |          2m31s |          2m40s |   +9s |

Code coverage of files in pull request scope (84.9% → 85.0%, patch 93.7%)

Details
Files Coverage +/- Patch Coverage Status
packages/core/src/components/action-panel/ActionPanel.tsx 100.0% 0.0% - modified
packages/core/src/components/activity-card/ActivityCard.tsx 59.6% 0.0% - modified
packages/core/src/components/activity-card/standalone.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/chain-of-thought.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/chat-history.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/conversation.tsx 93.6% 0.0% - modified
packages/core/src/components/ai-chat/disclosure.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/header.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/message.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/reasoning.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/response.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/sources.tsx 100.0% 0.0% - modified
packages/core/src/components/ai-chat/tool.tsx 100.0% 0.0% - modified
packages/core/src/components/alert/alert.tsx 100.0% 0.0% - modified
packages/core/src/components/appearance-switcher/appearance-switcher.tsx 93.3% 0.0% - modified
packages/core/src/components/appshell/appshell.tsx 78.3% 0.0% - modified
packages/core/src/components/attachment/Attachment.tsx 73.6% 0.0% - modified
packages/core/src/components/autocomplete/autocomplete.tsx 90.6% 0.0% - modified
packages/core/src/components/avatar/avatar.tsx 100.0% 0.0% - modified
packages/core/src/components/badge-list/badge-list.tsx 100.0% 0.0% - modified
packages/core/src/components/badge/badge.tsx 100.0% 0.0% - modified
packages/core/src/components/button/button.tsx 100.0% 0.0% - modified
packages/core/src/components/calendar/calendar-view.tsx 81.8% 0.0% - modified
packages/core/src/components/card/card.tsx 100.0% 0.0% - modified
packages/core/src/components/checkbox/checkbox.tsx 100.0% 0.0% - modified
packages/core/src/components/combobox/combobox.tsx 97.7% 0.0% - modified
packages/core/src/components/command-palette/command-palette.tsx 92.8% 0.0% 100.0% modified
packages/core/src/components/csv-importer/CsvImporter.tsx 0.5% 0.0% - modified
packages/core/src/components/data-table/column-settings.tsx 90.6% 0.0% - modified
packages/core/src/components/data-table/data-table.tsx 92.9% 0.0% - modified
packages/core/src/components/data-table/editable-cell.tsx 95.3% 0.0% - modified
packages/core/src/components/data-table/pagination.tsx 95.0% 0.0% - modified
packages/core/src/components/data-table/selection-bar.tsx 100.0% 0.0% - modified
packages/core/src/components/data-table/toolbar.tsx 84.5% 0.0% 100.0% modified
packages/core/src/components/description-card/DescriptionCard.tsx 85.2% 0.0% - modified
packages/core/src/components/description-card/field-renderers.tsx 84.7% +0.6% 88.8% modified
packages/core/src/components/dialog/dialog.tsx 95.2% 0.0% - modified
packages/core/src/components/document-progress-card/DocumentProgressCard.tsx 100.0% 0.0% - modified
packages/core/src/components/field/field.tsx 100.0% 0.0% - modified
packages/core/src/components/fieldset/fieldset.tsx 100.0% 0.0% 100.0% modified
packages/core/src/components/filter-rail/controls.tsx 66.1% 0.0% - modified
packages/core/src/components/filter-rail/filter-rail.tsx 96.7% 0.0% - modified
packages/core/src/components/filter-rail/internals.tsx 100.0% 0.0% 100.0% modified
packages/core/src/components/filter-rail/responsive.tsx 100.0% 0.0% - modified
packages/core/src/components/filter-rail/sections.tsx 95.3% 0.0% - modified
packages/core/src/components/filter-rail/settings.tsx 67.6% 0.0% - modified
packages/core/src/components/input/input.tsx 100.0% 0.0% - modified
packages/core/src/components/internals/app-info/app-info.tsx 100.0% 0.0% - modified
packages/core/src/components/internals/async-error-state/async-error-state.tsx 100.0% 0.0% - modified
packages/core/src/components/internals/breadcrumb/breadcrumb.tsx 75.0% 0.0% - modified
packages/core/src/components/internals/default-error-boundary/default-error-boundary.tsx 80.0% 0.0% - modified
packages/core/src/components/layout/Layout.tsx 100.0% 0.0% - modified
packages/core/src/components/menu/menu.tsx 90.6% 0.0% - modified
packages/core/src/components/metric-card/MetricCard.tsx 100.0% 0.0% - modified
packages/core/src/components/select/select-standalone.tsx 95.8% 0.0% - modified
packages/core/src/components/select/select.tsx 100.0% 0.0% - modified
packages/core/src/components/sheet/sheet.tsx 97.1% 0.0% - modified
packages/core/src/components/sidebar/default-sidebar.tsx 97.5% 0.0% - modified
packages/core/src/components/sidebar/global-header.tsx 100.0% 0.0% - modified
packages/core/src/components/sidebar/primitives.tsx 78.7% 0.0% - modified
packages/core/src/components/sidebar/sidebar-group.tsx 91.6% 0.0% - modified
packages/core/src/components/table/table.tsx 100.0% 0.0% - modified
packages/core/src/components/tabs/tabs.tsx 100.0% 0.0% - modified
packages/core/src/components/text/text.tsx 100.0% 0.0% - modified
packages/core/src/components/tooltip/tooltip.tsx 100.0% 0.0% - modified

Reported by octocov

…-in-components

# Conflicts:
#	docs-manifest.json
#	packages/core/__snapshots__/src__components__alert__alert.test.tsx.snap
#	packages/core/src/components/alert/alert.tsx
@wemra3
wemra3 merged commit eb44189 into main Oct 23, 2026
8 checks passed
@wemra3
wemra3 deleted the feat/typography-roles-in-components branch October 23, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants