Skip to content

fix(CDS-2206): support font prop on Tabs - #825

Open
adrienzheng-cb wants to merge 2 commits into
masterfrom
adrien/cds-2206-support-font-prop-on-tabs
Open

fix(CDS-2206): support font prop on Tabs#825
adrienzheng-cb wants to merge 2 commits into
masterfrom
adrien/cds-2206-support-font-prop-on-tabs

Conversation

@adrienzheng-cb

Copy link
Copy Markdown
Contributor

What changed? Why?

Tabs exposed a font prop that had no effect on the tab labels (CDS-2206). This PR makes it work (and forwards related typography props) instead of deprecating it, since SegmentedTab already consumes these and the wiring is straightforward.

Now threaded from TabsDefaultTab → label Text on both web and mobile:

  • font (still defaults to headline)
  • fontFamily, fontSize, fontWeight, lineHeight
  • textTransform
  • label alignment: textAlign (web) / align (mobile)

This matches the exact set SegmentedTab supports, so the two tab renderers behave identically. All props are optional and fall back to the font token, so there is no behavior change unless a consumer opts in. As a side effect, font on <SegmentedTabs> now works too (previously only settable per-SegmentedTab).

Root cause (required for bugfixes)

font (and the other typography props) appeared on TabsProps only via HStack/Box inheritance, so they were applied to the root tablist container. DefaultTab hardcoded font=\"headline\" on the label Text and never read them. The fix destructures these props in Tabs, forwards them through renderedTabProps, and applies them on the DefaultTab label Text (so they no longer leak onto the container).

Note on the web/mobile alignment prop name

Label alignment uses each platform's native Text API: textAlign on web and align on mobile (mobile Text derives alignment from align via useTextAlign and ignores a textAlign style prop). This mirrors the existing CDS Text convention.

UI changes

N/A visually by default (defaults unchanged). Opting into font/typography props now correctly restyles tab labels.

Testing

How has it been tested?

  • Unit tests (web + mobile)

Testing instructions

  • Web: yarn nx run web:test --testPathPattern=\"tabs/__tests__/Tabs.test\"
  • Mobile: yarn nx run mobile:test --testPathPattern=\"tabs/__tests__/Tabs.test\"
  • Added coverage: default label typography is headline; a Tabs-level font reaches every label; granular props (fontFamily/fontWeight), textTransform, and alignment are forwarded.

Change management

type=routine
risk=low
impact=sev5

automerge=false

Made with Cursor

@linear

linear Bot commented Aug 5, 2026

Copy link
Copy Markdown

CDS-2206

@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

@hcopp

hcopp commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@adrienzheng-cb code looks great can you bump version?

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

adrienzheng-cb and others added 2 commits August 13, 2026 14:07
The `font` prop (and related typography props) surfaced on `Tabs` via
`Box`/`HStack` inheritance but landed on the root container instead of
the tab labels, which hardcoded `font="headline"`. Thread `font`,
`fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `textTransform`,
and label alignment (`textAlign` on web, `align` on mobile) from `Tabs`
through to the `DefaultTab` label `Text`, matching how `SegmentedTab`
already consumes them. `font` still defaults to `headline`.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@adrienzheng-cb
adrienzheng-cb force-pushed the adrien/cds-2206-support-font-prop-on-tabs branch from 5b18f0a to 7e91a85 Compare August 13, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants