Skip to content

refactor(TopNav,SideNav): rename title → heading, rename components - #527

Merged
cixzhang merged 1 commit into
mainfrom
navi/feat/rename-title-to-heading
Mar 8, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/feat/rename-title-to-heading

Conversation

@cixzhang

@cixzhang cixzhang commented Mar 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Renames title to heading on TopNav and SideNav heading components, and renames the components themselves to match.

Why

The title prop collided with the HTML title attribute (string tooltip). TopNav used Omit<XDSBaseProps, 'title'> to work around this. Renaming eliminates the collision and makes the naming more accurate — these are headings, not tooltips.

Prop renames

XDSTopNav:

  • title → heading (ReactNode slot prop)
  • Removes Omit<XDSBaseProps, 'title'> — now extends XDSBaseProps directly

XDSTopNavTitle → XDSTopNavHeading:

  • title → heading (string)
  • File, component, interface, displayName all renamed
  • xds-top-nav-title → xds-top-nav-heading (stable class name)

XDSSideNavHeader → XDSSideNavHeading:

  • title → heading
  • titleHref → headingHref
  • supertitle → superheading
  • supertitleHref → superheadingHref
  • subtitle → subheading
  • subtitleHref → subheadingHref
  • File, component, interface, displayName all renamed
  • xds-side-nav-header → xds-side-nav-heading (stable class name)

Backward compatibility

Old component names are preserved as deprecated re-exports:

  • XDSTopNavTitle → deprecated alias for XDSTopNavHeading
  • XDSTopNavTitleProps → deprecated alias for XDSTopNavHeadingProps
  • XDSSideNavHeader → deprecated alias for XDSSideNavHeading
  • XDSSideNavHeaderProps → deprecated alias for XDSSideNavHeadingProps

Files changed (25)

Core components:

  • packages/core/src/TopNav/XDSTopNav.tsx — prop rename, remove Omit workaround
  • packages/core/src/TopNav/XDSTopNavTitle.tsx → XDSTopNavHeading.tsx — full rename
  • packages/core/src/TopNav/index.ts — new exports + deprecated re-exports
  • packages/core/src/SideNav/XDSSideNavHeader.tsx → XDSSideNavHeading.tsx — full rename
  • packages/core/src/SideNav/index.ts — new exports + deprecated re-exports
  • packages/core/src/SideNav/XDSSideNav.tsx — JSDoc updates

Docs:

  • packages/core/src/TopNav/TopNav.doc.mjs
  • packages/core/src/SideNav/SideNav.doc.mjs
  • packages/core/src/AppShell/AppShell.doc.mjs
  • packages/core/src/AppShell/XDSAppShell.tsx — JSDoc update
  • packages/core/src/NavIcon/NavIcon.doc.mjs
  • packages/core/src/NavIcon/XDSNavIcon.tsx — JSDoc update

Tests:

  • packages/core/src/TopNav/XDSTopNav.test.tsx
  • packages/core/src/SideNav/XDSSideNav.test.tsx
  • packages/core/src/Layout/__tests__/edgeCompensation.test.tsx

Stories:

  • apps/storybook/stories/TopNav.stories.tsx
  • apps/storybook/stories/SideNav.stories.tsx
  • apps/storybook/stories/AppShell.stories.tsx
  • apps/storybook/stories/MobileNav.stories.tsx
  • apps/storybook/stories/TopNavMenu.stories.tsx

Sandbox pages:

  • apps/sandbox/src/app/pages/mega-menu/page.tsx
  • apps/sandbox/src/app/pages/navigation/page.tsx
  • apps/sandbox/src/app/pages/polymorphic-link/page.tsx
  • apps/sandbox/src/app/pages/topnav-menu/page.tsx

Internal:

  • internal/vibe-tests/src/universal-eval.ts

Verification

  • ✅ yarn build — passes
  • ✅ yarn test — 1358 tests pass
  • ✅ yarn lint — no errors (only pre-existing warnings)

BREAKING CHANGE: Prop renames on XDSTopNav, XDSTopNavTitle, and XDSSideNavHeader.

XDSTopNav:
- title → heading (ReactNode slot prop)
- Removes Omit<XDSBaseProps, 'title'> workaround — now extends XDSBaseProps directly

XDSTopNavTitle → XDSTopNavHeading:
- title → heading (string prop)
- File, component, interface, displayName all renamed
- xds-top-nav-title → xds-top-nav-heading (stable class name)

XDSSideNavHeader → XDSSideNavHeading:
- title → heading
- titleHref → headingHref
- supertitle → superheading
- supertitleHref → superheadingHref
- subtitle → subheading
- subtitleHref → subheadingHref
- File, component, interface, displayName all renamed
- xds-side-nav-header → xds-side-nav-heading (stable class name)

Backward-compatible re-exports:
- XDSTopNavTitle (deprecated alias for XDSTopNavHeading)
- XDSTopNavTitleProps (deprecated alias for XDSTopNavHeadingProps)
- XDSSideNavHeader (deprecated alias for XDSSideNavHeading)
- XDSSideNavHeaderProps (deprecated alias for XDSSideNavHeadingProps)

Why: The title prop collided with the HTML title attribute (string tooltip).
TopNav used Omit<XDSBaseProps, 'title'> to work around this. Renaming
eliminates the collision and makes the naming more accurate — these are
headings, not tooltips.

Co-authored-by: Navi <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 8, 2026
@github-actions

github-actions Bot commented Mar 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

AppShell · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 561B N/A
Lines of Code N/A 313 -
Complexity N/A Very High (32) -
Layout · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 991B N/A
Lines of Code N/A 747 -
Complexity N/A Very High (45) -
NavIcon
Metric Before After Delta
Bundle Size (ESM) N/A 175B N/A
Lines of Code N/A 41 -
Complexity N/A Low (1) -
SideNav · View in Storybook · 🆕 XDSSideNavHeading, XDSSideNavHeading
Metric Before After Delta
Bundle Size (ESM) N/A 688B N/A
Lines of Code N/A 849 -
Complexity N/A Very High (70) -
TopNav · View in Storybook · 🆕 XDSTopNavHeading, XDSTopNavHeading
Metric Before After Delta
Bundle Size (ESM) N/A 553B N/A
Lines of Code N/A 979 -
Complexity N/A Very High (50) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 9.1KB 14.7KB 2.3KB

Accessibility Audit

Status: 2 accessibility violation(s) found — 2 serious.

XDSLayout - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
XDSSideNav - 1 issue(s)
  • 🟠 serious: Ensure links have discernible text
    • Rule: link-name · Affects 1/8 stories · Learn more
    • WCAG: 2.4.4, 4.1.2 (Level A)

Component Previews

Includes interactive hover previews as animated GIFs.

XDSAppShell

Top Nav With Side Nav

Screenshot:

Top Nav With Side Nav

Interaction Preview: (view video)

Top Nav With Side Nav interaction

View in Storybook · core-xdsappshell--top-nav-with-side-nav

Side Nav Only

Screenshot:

Side Nav Only

View in Storybook · core-xdsappshell--side-nav-only

Top Nav Only

Screenshot:

Top Nav Only

View in Storybook · core-xdsappshell--top-nav-only

Full Featured

Screenshot:

Full Featured

View in Storybook · core-xdsappshell--full-featured

Auto Height

Screenshot:

Auto Height

View in Storybook · core-xdsappshell--auto-height

Controlled Collapse

Screenshot:

Controlled Collapse

View in Storybook · core-xdsappshell--controlled-collapse

Content Only

Screenshot:

Content Only

View in Storybook · core-xdsappshell--content-only

With Banner

Screenshot:

With Banner

View in Storybook · core-xdsappshell--with-banner

With Mobile Nav

Screenshot:

With Mobile Nav

View in Storybook · core-xdsappshell--with-mobile-nav

XDSLayout

Playground

Screenshot:

Playground

Interaction Preview: (view video)

Playground interaction

View in Storybook · layout-xdslayout--playground

Basic Card Layout

Screenshot:

Basic Card Layout

View in Storybook · layout-xdslayout--basic-card

Layout with Sidebar

Screenshot:

Layout with Sidebar

View in Storybook · layout-xdslayout--with-sidebar

Dual Panel Layout

Screenshot:

Dual Panel Layout

View in Storybook · layout-xdslayout--dual-panels

Without Dividers

Screenshot:

Without Dividers

View in Storybook · layout-xdslayout--no-dividers

Full Bleed Content

Screenshot:

Full Bleed Content

View in Storybook · layout-xdslayout--full-bleed-content

Section Variants

Screenshot:

Section Variants

View in Storybook · layout-xdslayout--section-variants

Content Only

Screenshot:

Content Only

View in Storybook · layout-xdslayout--content-only

Themed Layout (Neutral vs Default)

Screenshot:

Themed Layout (Neutral vs Default)

View in Storybook · layout-xdslayout--themed-layout

Outer Padding Demonstration

Screenshot:

Outer Padding Demonstration

View in Storybook · layout-xdslayout--outer-padding-demo

XDSSideNav

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

View in Storybook · navigation-xdssidenav--default

Title Without Icon

Screenshot:

Title Without Icon

View in Storybook · navigation-xdssidenav--title-without-icon

Header with Menu

Screenshot:

Header with Menu

View in Storybook · navigation-xdssidenav--with-header-menu

Suite with Independent Links

Screenshot:

Suite with Independent Links

View in Storybook · navigation-xdssidenav--suite-header

Nested Items

Screenshot:

Nested Items

View in Storybook · navigation-xdssidenav--nested-items

With Footer Icons

Screenshot:

With Footer Icons

View in Storybook · navigation-xdssidenav--with-footer

Disabled Items

Screenshot:

Disabled Items

View in Storybook · navigation-xdssidenav--disabled-item

Hidden Section Header

Screenshot:

Hidden Section Header

View in Storybook · navigation-xdssidenav--hidden-section-header

XDSTopNav

Default

Screenshot:

Default

Interaction Preview: (view video)

Default interaction

View in Storybook · navigation-xdstopnav--default

With Logo

Screenshot:

With Logo

View in Storybook · navigation-xdstopnav--with-logo

Title Only

Screenshot:

Title Only

View in Storybook · navigation-xdstopnav--title-only

Nav Item States

Screenshot:

Nav Item States

View in Storybook · navigation-xdstopnav--nav-item-states

Centered Navigation

Screenshot:

Centered Navigation

View in Storybook · navigation-xdstopnav--centered-navigation

Centered With Start Content

Screenshot:

Centered With Start Content

View in Storybook · navigation-xdstopnav--centered-with-start-content

Center Content Without End

Screenshot:

Center Content Without End

View in Storybook · navigation-xdstopnav--center-content-without-end

Full Example

Screenshot:

Full Example

View in Storybook · navigation-xdstopnav--full-example


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang merged commit 11b5b4e into main Mar 8, 2026
14 checks passed
cixzhang pushed a commit that referenced this pull request Mar 8, 2026
Add codemods for the heading rename from PR #527:

1. rename-topnav-title-to-heading: Renames title → heading prop on
   XDSTopNav/XDSTopNavTitle/XDSTopNavHeading, renames XDSTopNavTitle
   component and imports to XDSTopNavHeading.

2. rename-sidenav-header-to-heading: Renames all props (title → heading,
   titleHref → headingHref, supertitle → superheading, etc.) on
   XDSSideNavHeader/XDSSideNavHeading, renames the component and imports.

Both codemods handle:
- Prop renames on target components only (no false positives)
- JSX element name renames (opening + closing tags)
- Import specifier renames (including Props types)
- Aliased imports (renames imported name, preserves alias)
- Returns undefined when no changes needed

Also fixes SideNav.doc.mjs: XDSSideNavSection examples incorrectly used
heading= prop instead of title= (over-renamed in PR #527).
cixzhang pushed a commit that referenced this pull request Mar 8, 2026
BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs.

Removed:
- XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps)
- XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps)
- useXDSIcon hook (use getIcon from globalIconRegistry)
- IconRegistryContext (use registerIcons + getIcon)
- IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx)
- getGlobalRegistry internal helper (no longer needed)

Added:
- migrate-useXDSIcon-to-getIcon codemod with 11 tests
- Updates internal imports from IconRegistry to globalIconRegistry

Migration codemods exist for all removed APIs:
- rename-topnav-title-to-heading (PR #530)
- rename-sidenav-header-to-heading (PR #530)
- migrate-useXDSIcon-to-getIcon (this PR)

Refs: #527, #530, #531
cixzhang added a commit that referenced this pull request Mar 8, 2026
….2 (#533)

BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs.

Removed:
- XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps)
- XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps)
- useXDSIcon hook (use getIcon from globalIconRegistry)
- IconRegistryContext (use registerIcons + getIcon)
- IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx)
- getGlobalRegistry internal helper (no longer needed)

Added:
- migrate-useXDSIcon-to-getIcon codemod with 11 tests
- Updates internal imports from IconRegistry to globalIconRegistry

Migration codemods exist for all removed APIs:
- rename-topnav-title-to-heading (PR #530)
- rename-sidenav-header-to-heading (PR #530)
- migrate-useXDSIcon-to-getIcon (this PR)

Refs: #527, #530, #531

Co-authored-by: navi[bot] <[email protected]>
@cixzhang
cixzhang deleted the navi/feat/rename-title-to-heading branch March 13, 2026 10:50
cixzhang added a commit that referenced this pull request Apr 26, 2026
….2 (#533)

BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs.

Removed:
- XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps)
- XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps)
- useXDSIcon hook (use getIcon from globalIconRegistry)
- IconRegistryContext (use registerIcons + getIcon)
- IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx)
- getGlobalRegistry internal helper (no longer needed)

Added:
- migrate-useXDSIcon-to-getIcon codemod with 11 tests
- Updates internal imports from IconRegistry to globalIconRegistry

Migration codemods exist for all removed APIs:
- rename-topnav-title-to-heading (PR #530)
- rename-sidenav-header-to-heading (PR #530)
- migrate-useXDSIcon-to-getIcon (this PR)

Refs: #527, #530, #531

Co-authored-by: navi[bot] <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
….2 (#533)

BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs.

Removed:
- XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps)
- XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps)
- useXDSIcon hook (use getIcon from globalIconRegistry)
- IconRegistryContext (use registerIcons + getIcon)
- IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx)
- getGlobalRegistry internal helper (no longer needed)

Added:
- migrate-useXDSIcon-to-getIcon codemod with 11 tests
- Updates internal imports from IconRegistry to globalIconRegistry

Migration codemods exist for all removed APIs:
- rename-topnav-title-to-heading (PR #530)
- rename-sidenav-header-to-heading (PR #530)
- migrate-useXDSIcon-to-getIcon (this PR)

Refs: #527, #530, #531

Co-authored-by: navi[bot] <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
….2 (#533)

BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs.

Removed:
- XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps)
- XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps)
- useXDSIcon hook (use getIcon from globalIconRegistry)
- IconRegistryContext (use registerIcons + getIcon)
- IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx)
- getGlobalRegistry internal helper (no longer needed)

Added:
- migrate-useXDSIcon-to-getIcon codemod with 11 tests
- Updates internal imports from IconRegistry to globalIconRegistry

Migration codemods exist for all removed APIs:
- rename-topnav-title-to-heading (PR #530)
- rename-sidenav-header-to-heading (PR #530)
- migrate-useXDSIcon-to-getIcon (this PR)

Refs: #527, #530, #531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant