const BasicInPageNavigation = () => {return (<InPageNavigation aria-label="get started"><InPageNavigationItem href="#" currentPage>Super SIM</InPageNavigationItem><InPageNavigationItem href="#">Programmable Wireless</InPageNavigationItem></InPageNavigation>);};render(<BasicInPageNavigation />)
In Page Navigation allows users to navigate between related pages using a styled set of links. Each In Page Navigation Item is an anchor that links to a related page. Each of the related pages should have its own In Page Navigation component so that users can easily navigate back and forth within a set of related pages.
If you need to switch between multiple views within a single page without taking users to a new URL, use Tabs.
In Page Navigation contains the following elements:
InPageNavigationItem
: Clickable element that navigates to a new URLInPageNavigation
: A collection ofInPageNavigationItem
s
Tabs are used to layer related pieces of information together and display one layer at a time on the same URL. Use Tabs to alternate between views within the same context. Tabs are especially useful when each view presents similar, parallel information, like code in different languages or data visualization in different formats.
In Page Navigation is a collection of anchors, rather than buttons. Use In Page Navigation to switch between different but related pages, especially when there are actions to take on each page.
- Each In Page Navigation must have a unique label. To add the label, add the
aria-label
prop to the<InPageNavigation>
tag. Omit the term 'navigation'—it’s redundant since the role is already defined as 'navigation'. - Each In Page Navigation must specify the selected page. To specify which page is selected, set the
currentPage
prop to the respective<InPageNavigationItem>
. Doing so will setaria-current="page"
on that link. - To interact with In Page Navigation using the keyboard, use the tab key to navigate between items and the enter key to select an item.
Use Horizontal In Page Navigation in most cases.
const BasicInPageNavigation = () => {return (<InPageNavigation aria-label="get started"><InPageNavigationItem href="#" currentPage>Super SIM</InPageNavigationItem><InPageNavigationItem href="#">Programmable Wireless</InPageNavigationItem></InPageNavigation>);};render(<BasicInPageNavigation />)
Use full-width In Page Navigation to fit the width of a containing element. Each item will expand equally to the same width. The full-width variant is recommended for compact spaces.
const FullWidthInPageNavigation = () => {return (<InPageNavigation aria-label="privacy" variant="fullWidth"><InPageNavigationItem href="#" currentPage>Home</InPageNavigationItem><InPageNavigationItem href="#">Detection</InPageNavigationItem><InPageNavigationItem href="#">Settings</InPageNavigationItem></InPageNavigation>);};render(<FullWidthInPageNavigation />)
Use Vertical In Page Navigation when creating a second layer of hierarchy underneath a horizontal or full-width In Page Navigation.
Place this vertical In Page Navigation on the left side of the page, and wrap it in a Box with a right margin of space-110
.
const VerticalInPageNavigation = () => {return (<Box marginRight="space110"><InPageNavigation aria-label="privacy" orientation="vertical"><InPageNavigationItem href="#" currentPage>Space name</InPageNavigationItem><InPageNavigationItem href="#">Connection policy</InPageNavigationItem><InPageNavigationItem href="#">Labels</InPageNavigationItem></InPageNavigation></Box>);};render(<VerticalInPageNavigation />)
Don't add interactive elements to an In Page Navigation item since it makes it difficult for users of assistive technologies to focus or click on an item.
In Page Navigation labels should be short to improve readability. Users should be able to easily scan the items and know what type of content to expect. Try to keep labels to 1-2 words each.
Labels should be parallel parts of speech. For example, all nouns (Documents, Images, Downloads).
Do
Use In Page Navigation for navigating users to different but related pages, such as different pages of settings.
Don't
Don’t use In Page Navigation when swapping between views on the same page. Use Tabs instead.
Do
Keep In Page Navigation labels concise.
Don't
Don’t use more than 2 words in an In Page Navigation label, unless absolutely necessary.