Skip to content
CraftDocs
Home
Home
Changelog
What's New
Guide
Guide
Getting Started
Principles
Styling Components
Theme System
Foundations
All Tokens
Color
Elevation
Icons
Motion
Shape
Spacing
Typography
Libraries
Libraries
@xds/cli
@xds/core
Themes
Themes
Theme: daily
Default Theme
Theme: matcha
Neutral Theme
Components
Components
AppShell
AspectRatio
Avatar
Avatar
AvatarStatusDot
Badge
Banner
Breadcrumbs
BreadcrumbItem
Breadcrumbs
Button
Button
IconButton
ToggleButton
ToggleButtonGroup
Calendar
Card
Carousel
Chat
ChatComposer
ChatComposerDrawer
ChatComposerInput
ChatComposerTokenElement
ChatDictationButton
ChatLayout
ChatLayoutScrollButton
ChatMessage
ChatMessageBubble
ChatMessageList
ChatMessageMetadata
ChatSendButton
ChatSystemMessage
ChatTokenizedText
ChatToolCalls
Checkbox
CheckboxInput
CheckboxList
CheckboxListItem
ClickableCard
Code
CodeBlock
Collapsible
Collapsible
CollapsibleGroup
useXDSCollapsible
CommandPalette
CommandPalette
CommandPaletteEmpty
CommandPaletteFooter
CommandPaletteGroup
CommandPaletteInput
CommandPaletteItem
CommandPaletteList
DateInput
Dialog
AlertDialog
Dialog
DialogHeader
useXDSImperativeAlertDialog
useXDSImperativeDialog
Divider
DropdownMenu
DropdownMenu
DropdownMenuDivider
DropdownMenuItem
DropdownMenuItemData
DropdownMenuSection
EmptyState
Field
Field
FieldLabel
FieldStatus
Heading
HoverCard
Icon
Kbd
Layout
Center
FormLayout
Grid
GridSpan
HStack
Layout
LayoutContainer
LayoutContent
LayoutFooter
LayoutHeader
LayoutPanel
Section
StackItem
VStack
Link
List
List
ListItem
Markdown
MetadataList
MetadataList
MetadataListItem
MobileNav
MoreMenu
NavHeadingMenu
NavIcon
NumberInput
OverflowList
Pagination
Popover
PowerSearch
ProgressBar
Radio
RadioList
RadioListItem
Resizable
ResizeHandle
useXDSResizable
SegmentedControl
SegmentedControl
SegmentedControlItem
SelectableCard
Selector
MultiSelector
Selector
SelectorOption
SideNav
SideNav
SideNavCollapseButton
SideNavHeading
SideNavItem
SideNavSection
Skeleton
Slider
Spinner
StatusDot
Switch
Table
BaseTable
Table
TableCell
TableHeaderCell
TableRow
useXDSTableColumnSettings
useXDSTablePagination
useXDSTableSelection
useXDSTableSelectionState
useXDSTableSortable
Tabs
Tab
TabList
TabMenu
Text
TextArea
TextInput
Thumbnail
TimeInput
Timestamp
Toast
Toast
useXDSToast
Token
Tokenizer
Toolbar
Tooltip
TopNav
TopNav
TopNavHeading
TopNavItem
TopNavMegaMenu
TopNavMegaMenuFeaturedCard
TopNavMegaMenuItem
TopNavMenu
TreeList
Typeahead
BaseTypeahead
Typeahead
TypeaheadItem
useXDSHoverCard
useXDSPopover
useXDSTooltip
Utilities
Utilities
LinkProvider
MediaTheme
SyntaxTheme
Theme
useClickableContainer
useEntryAnimation
useFocusTrap
useGridFocus
useImageMode
useInputContainer
useListFocus
useMediaQuery
useOverflow
useScrollLock
useScrollOverflow
useXDSLayer
useXDSStreamingText
Terms of UsePrivacy Policy
Type to search
↑↓Navigate↵SelectEscClose
TopNav@xds/core v0.0.13 · XDSTopNav

Usage

TopNav is a horizontal navigation bar for product-level navigation in application headers. Use TopNav for 5 or fewer always-visible navigation items, or minimal navigation paired with search and controls. For complex navigation hierarchies, use a sidebar; to filter content, use tabs or filter buttons instead.
ts
import {XDSTopNav} from '@xds/core/TopNav'

Best practices

GuidancePractices
DoInclude a product logo and name in the heading slot to clearly identify the application.
DoLimit primary navigation items to 5 or fewer for quick scanning and minimal cognitive load.
Don'tAvoid using TopNav to filter page content — use Tabs or filter controls instead.
Don'tAvoid deeply nested navigation hierarchies — keep menus to one level of depth.

Sub-components

TopNav is a compound component with 7 sub-components.

XDSTopNav

Main navigation bar container with slot-based layout.
PropTypeDescription
heading
ReactNodeHeading slot content (logo, brand) — positioned at the left edge of the nav bar.
startContent
ReactNodeStart content slot for navigation items or breadcrumbs — positioned after the heading, left-aligned.
centerContent
ReactNodeCenter content slot (tabs, search bar, primary navigation) — when provided, switches the layout to a three-column CSS grid for true horizontal centering.
endContent
ReactNodeEnd content slot for search, icons, or user profile — positioned at the right edge.
label
stringAccessible label for the navigation landmark, applied as aria-label on the <nav> element.
xstyle
StyleXStylesStyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value — not an inline style object like style={{}}.

XDSTopNavHeading

Product/suite/account heading for the XDSTopNav heading slot. Supports smart interaction boundary logic: logo, heading text, superheading/subheading with independent links, and an optional menu popover with automatic chevron indicator.
PropTypeDescription
logo
ReactNodeLogo element to display before the heading text. Can be an image, XDSNavIcon, or any ReactNode.
heading
stringProduct/app name displayed as the primary heading text.
headingHref
stringLink for the heading text (e.g. product home). When no menu is present and this is the only href, the whole heading becomes one clickable link.
href
stringDeprecated — use headingHref instead. URL to navigate to when clicked.
superheading
stringText above the heading (e.g. suite name). Rendered in a smaller secondary style.
superheadingHref
stringLink for the superheading text (e.g. suite home). When provided alongside a menu, renders as an independent inline link.
subheading
stringText below the heading (e.g. account context). Rendered in a smaller secondary style.
subheadingHref
stringLink for the subheading text. When provided alongside a menu, renders as an independent inline link.
headerEndContent
ReactNodeContent rendered at the trailing edge of the heading row (e.g. a badge or status indicator).
menu
ReactNodeMenu content shown in a popover dropdown. When provided, a chevron indicator appears automatically. Interaction boundary is determined by the presence of hrefs: no hrefs means the whole header is the trigger; with hrefs, links are independent and the chevron area is the trigger.
as
XDSLinkComponentTypeCustom component to render instead of <a>. Overrides the provider-level default set by XDSLinkProvider. Must accept href, className, style, and children props.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

XDSTopNavItem

Navigation link item for use in XDSTopNav startContent — renders as an anchor with hover and selected states.
PropTypeDescription
labelrequired
stringAccessible label for the nav item. Rendered as visible text by default. When isIconOnly is true, used as aria-label instead.
href
stringNavigation target URL.
isSelected
boolean (default: false)Whether this nav item is currently selected. Sets aria-current="page" and applies highlighted styles.
isDisabled
boolean (default: false)Whether the nav item is disabled. Sets aria-disabled and prevents interaction.
isIconOnly
boolean (default: false)Renders the item as a square icon-only element. When true, label becomes the aria-label and visible text is hidden. Requires icon to be set.
icon
ReactNodeOptional icon to display before the label.
children
ReactNodeCustom content to render instead of the label text.
as
XDSLinkComponentTypeCustom component to render instead of <a>. Overrides the provider-level default set by XDSLinkProvider. Must accept href, className, style, and children props.

XDSTopNavMegaMenu

Navigation item that displays a full-width mega menu panel on hover. Uses a slots API with items and featured props. XDSTopNavMegaMenuItem renders itself in both desktop and mobile drawer modes. Supports inline collapsible drawer via render mode context.
PropTypeDescription
labelrequired
stringVisible label for the trigger button.
items
ReactNodeMenu items slot — typically XDSTopNavMegaMenuItem components, but accepts any ReactNode.
featured
ReactNodeFeatured content slot — rendered in the right panel on desktop, below items in the mobile drawer.
delay
number (default: 150)Delay in milliseconds before showing the menu on hover.
hideDelay
number (default: 250)Delay in milliseconds before hiding the menu after the mouse leaves.
onOpenChange
(isOpen: boolean) => voidCallback fired when the mega menu opens or closes. Useful for coordinating wrapper styles.

XDSTopNavMegaMenuFeaturedCard

Standard featured card for the XDSTopNavMegaMenu featured slot. Provides a consistent card with optional image, title, description, and CTA link.
PropTypeDescription
titlerequired
stringCard title.
description
stringDescription text below the title.
image
stringOptional image URL displayed above the body.
imageAlt
stringAlt text for the image.
linkLabel
stringCTA link text.
linkHref
stringCTA link URL.
children
ReactNodeCustom content rendered below the standard body.

XDSTopNavMegaMenuItem

An individual item inside an XDSTopNavMegaMenu. Renders itself in both desktop (popover grid) and mobile drawer modes via render mode context.
PropTypeDescription
titlerequired
stringDisplay title for the menu item.
description
stringOptional description text displayed below the title.
icon
ReactNodeOptional icon element displayed to the left.
href
stringURL to navigate to when clicked.
onClick
() => voidCallback when item is clicked.
as
XDSLinkComponentTypeCustom component to render instead of <a> for link items. Overrides the provider-level default set by XDSLinkProvider.

XDSTopNavMenu

Navigation item that displays a hover-triggered popover menu with rich items containing an icon, title, and optional description.
PropTypeDescription
labelrequired
stringVisible label for the trigger button.
itemsrequired
XDSTopNavMenuItemData[]Menu items to display in the hover popover.
delay
number (default: 150)Delay in milliseconds before showing the menu on hover.
hideDelay
number (default: 200)Delay in milliseconds before hiding the menu after the mouse leaves.

Examples

Common configurations, variations, and states.
TopNav — Centered Navigation
Navigation layout with center-aligned nav items flanked by a logo heading and end actions.
TopNav — Enterprise Dashboard
Full-featured navigation bar with icon-labeled nav items, search, notifications, and a primary CTA.
TopNav — Hover Menu
Navigation bar with a hover-triggered dropdown menu showing product items with icons and descriptions.
TopNav — Mega Menu
Marketing-style navigation with a full-width mega menu featuring product items and a promotional featured card.
TopNav — Multiple Dropdowns
Navigation bar with multiple hover-triggered dropdown menus that auto-close when switching between them.
TopNav — With Logo
Navigation bar with a branded logo icon, heading link, nav items, and a profile action.