Use Anchor Bar...
- To display a horizontal sub-navigation, allowing you to link to a section of the current page.
Don't use Anchor Bar...
- To link outside of the page, instead you can use Left Hand Navigation , Links or Menu. Find out more in the guidelines page.
The preview has been updated.
List Item Description
Use the optional AnchorBarListItemDescription component to enable a description / sub-title for an anchor element. Use it as a child of the anchor element.
If using AnchorBarListItemDescription , we recommend using a description on all listed items to ensure consistent horizontal alignment of item and description copy.
The preview has been updated.
Sticky
Use sticky to make the Anchor Bar stick to the top of the viewport as the user scrolls past it. When using sticky, use onActiveAnchorChanged in combination with aria-current on list items to show the currently active list item. To associate a page element with an anchor, the href of the anchor must match the id of the element, prefixed with #. This creates a native HTML in-page anchor link.
onActiveAnchorChanged will be called when a destination element scrolls into the viewport.
The preview has been updated.
Background color
Use bgc or backgroundColor to set the background color of the Anchor Bar. The same background color will be used for both the default and sticky versions.
Use darkMode to use dark mode settings on darker colors.