Skip to content

Top Nav

@astryxdesign/core v0.7.1 · TopNav

TopNav Props ​

NameTypeDefaultDescription
labelstringLocalized “Top navigation”Accessible name of the landmark.
mobileQuerystring-When this media query matches, leading and center content moves into the mobile nav.

TopNav slots ​

NameDescription
headingBrand title. Stays on the bar at narrow widths.
startContent after the title.
defaultItems and menus laid out with start.
centerCentered region. Turns the bar into three columns.
endTrailing actions. Stays on the bar at narrow widths.

TopNavMenu Props ​

NameTypeDefaultDescription
labelstring-Trigger label.
itemsTopNavMenuItem[]-Data items. The default slot can render NavMenuItem instead.
showDelaynumber150Hover open delay, in milliseconds.
hideDelaynumber200Pointer-leave close delay, in milliseconds.

TopNavMegaMenu Props ​

NameTypeDefaultDescription
labelstring-Trigger label and accessible name of the panel.
showDelaynumber150Hover open delay, in milliseconds.
hideDelaynumber250Pointer-leave close delay, in milliseconds.

Put TopNavMegaMenuItem in the default slot and TopNavMegaMenuFeaturedCard in featured. Inside the drawer the same content becomes an accordion and is not a menu.

TopNavHeading Props ​

NameTypeDefaultDescription
headingstring-Product or app name. Optional when the heading is only a logo.
hrefstring-Link for the main title. Same as headingHref, which wins when both are set.
headingHrefstring-Link for the main title.
superheadingstring-Small line above the title.
superheadingHrefstring-Link for the line above the title.
subheadingstring-Small line below the title.
subheadingHrefstring-Link for the line below the title.
logoLabelstring-Accessible name when the logo is a link and has no readable text beside it. Falls back to heading.
asNavLinkComponent'a'Link root used when an address is set. It receives href and to.

When only the main title has a link and there is no menu, the whole heading is one link. When there is a menu and no links, the whole heading opens the menu. When both are present, each line navigates on its own and only the chevron opens the menu.

TopNavHeading slots ​

NameDescription
logoMark in front of the title. Same place as icon; logo wins.
iconIcon in front of the title.
endTrailing content on the title row, such as a badge.
menuPopup menu, usually a NavHeadingMenu. The scope provides close and focusRequest.

TopNavMegaMenuFeaturedCard Props ​

NameTypeDefaultDescription
titlestring-Card title.
descriptionstring-Supporting line under the title.
hrefstring-Makes the whole card a link. With linkLabel, the link moves to the bottom of the card.
imagestring-Image shown above the text.
imageAltstring-Alternative text. Without it the image is decorative and skipped by assistive tech.
linkLabelstring-Action text at the bottom of the card.
linkHrefstring-Destination of the action. Falls back to href.
asNavLinkComponent'a'Link root.