Repository navigation
refactor(TopNav,SideNav): rename title → heading, rename components - #527
Conversation
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]>
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsAppShell · View in Storybook
Layout · View in Storybook
NavIcon
SideNav · View in Storybook · 🆕 XDSSideNavHeading, XDSSideNavHeading
TopNav · View in Storybook · 🆕 XDSTopNavHeading, XDSTopNavHeading
Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 2 serious. XDSLayout - 1 issue(s)
XDSSideNav - 1 issue(s)
Component PreviewsIncludes interactive hover previews as animated GIFs. XDSAppShellTop Nav With Side NavScreenshot: Interaction Preview: (view video) View in Storybook · XDSLayoutPlaygroundScreenshot: Interaction Preview: (view video) View in Storybook · XDSSideNavDefaultScreenshot: Interaction Preview: (view video) View in Storybook · XDSTopNavDefaultScreenshot: Interaction Preview: (view video) View in Storybook · Centered With Start ContentScreenshot: View in Storybook · Center Content Without EndScreenshot: View in Storybook · Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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).
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
….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]>
….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]>
….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]>
….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
What
Renames
titletoheadingon TopNav and SideNav heading components, and renames the components themselves to match.Why
The
titleprop collided with the HTMLtitleattribute (string tooltip). TopNav usedOmit<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)Omit<XDSBaseProps, 'title'>— now extendsXDSBasePropsdirectlyXDSTopNavTitle → XDSTopNavHeading:
title→heading(string)xds-top-nav-title→xds-top-nav-heading(stable class name)XDSSideNavHeader → XDSSideNavHeading:
title→headingtitleHref→headingHrefsupertitle→superheadingsupertitleHref→superheadingHrefsubtitle→subheadingsubtitleHref→subheadingHrefxds-side-nav-header→xds-side-nav-heading(stable class name)Backward compatibility
Old component names are preserved as deprecated re-exports:
XDSTopNavTitle→ deprecated alias forXDSTopNavHeadingXDSTopNavTitleProps→ deprecated alias forXDSTopNavHeadingPropsXDSSideNavHeader→ deprecated alias forXDSSideNavHeadingXDSSideNavHeaderProps→ deprecated alias forXDSSideNavHeadingPropsFiles changed (25)
Core components:
packages/core/src/TopNav/XDSTopNav.tsx— prop rename, remove Omit workaroundpackages/core/src/TopNav/XDSTopNavTitle.tsx→XDSTopNavHeading.tsx— full renamepackages/core/src/TopNav/index.ts— new exports + deprecated re-exportspackages/core/src/SideNav/XDSSideNavHeader.tsx→XDSSideNavHeading.tsx— full renamepackages/core/src/SideNav/index.ts— new exports + deprecated re-exportspackages/core/src/SideNav/XDSSideNav.tsx— JSDoc updatesDocs:
packages/core/src/TopNav/TopNav.doc.mjspackages/core/src/SideNav/SideNav.doc.mjspackages/core/src/AppShell/AppShell.doc.mjspackages/core/src/AppShell/XDSAppShell.tsx— JSDoc updatepackages/core/src/NavIcon/NavIcon.doc.mjspackages/core/src/NavIcon/XDSNavIcon.tsx— JSDoc updateTests:
packages/core/src/TopNav/XDSTopNav.test.tsxpackages/core/src/SideNav/XDSSideNav.test.tsxpackages/core/src/Layout/__tests__/edgeCompensation.test.tsxStories:
apps/storybook/stories/TopNav.stories.tsxapps/storybook/stories/SideNav.stories.tsxapps/storybook/stories/AppShell.stories.tsxapps/storybook/stories/MobileNav.stories.tsxapps/storybook/stories/TopNavMenu.stories.tsxSandbox pages:
apps/sandbox/src/app/pages/mega-menu/page.tsxapps/sandbox/src/app/pages/navigation/page.tsxapps/sandbox/src/app/pages/polymorphic-link/page.tsxapps/sandbox/src/app/pages/topnav-menu/page.tsxInternal:
internal/vibe-tests/src/universal-eval.tsVerification
yarn build— passesyarn test— 1358 tests passyarn lint— no errors (only pre-existing warnings)