import {UnderlineNav} from '@primer/react/drafts'
<UnderlineNav><UnderlineNav.Item selected>Item 1</UnderlineNav.Item><UnderlineNav.Item>Item 2</UnderlineNav.Item><UnderlineNav.Item>Item 3</UnderlineNav.Item></UnderlineNav>
<UnderlineNav><UnderlineNav.Item selected icon={CodeIcon}>Code</UnderlineNav.Item><UnderlineNav.Item icon={IssueOpenedIcon} counter={30}>Issues</UnderlineNav.Item><UnderlineNav.Item icon={GitPullRequestIcon} counter={3}>Pull requests</UnderlineNav.Item><UnderlineNav.Item icon={CommentDiscussionIcon}>Discussions</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={9}>Actions</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={7}>Projects</UnderlineNav.Item></UnderlineNav>
When overflow occurs, the component first hides icons if present to optimize for space and show as many items as possible. (Only for fine pointer devices)
<UnderlineNav><UnderlineNav.Item selected icon={CodeIcon}>Code</UnderlineNav.Item><UnderlineNav.Item icon={IssueOpenedIcon} counter={30}>Issues</UnderlineNav.Item><UnderlineNav.Item icon={GitPullRequestIcon} counter={3}>Pull requests</UnderlineNav.Item><UnderlineNav.Item icon={CommentDiscussionIcon}>Discussions</UnderlineNav.Item><UnderlineNav.Item icon={PlayIcon} counter={9}>Actions</UnderlineNav.Item><UnderlineNav.Item icon={ProjectIcon} counter={7}>Projects</UnderlineNav.Item><UnderlineNav.Item icon={ShieldLockIcon}>Security</UnderlineNav.Item><UnderlineNav.Item icon={GraphIcon}>Insights</UnderlineNav.Item><UnderlineNav.Item icon={GearIcon} counter={1}>Settings</UnderlineNav.Item></UnderlineNav>
More
menuIf there is still overflow, the component will behave depending on the pointer.
<UnderlineNav><UnderlineNav.Item selected icon={CodeIcon}>Code</UnderlineNav.Item><UnderlineNav.Item icon={IssueOpenedIcon} counter={30}>Issues</UnderlineNav.Item><UnderlineNav.Item icon={GitPullRequestIcon} counter={3}>Pull requests</UnderlineNav.Item><UnderlineNav.Item icon={CommentDiscussionIcon}>Discussions</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={9}>Actions</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={7}>Projects</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon}>Security</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={14}>Insights</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon} counter={1}>Settings</UnderlineNav.Item><UnderlineNav.Item icon={EyeIcon}>Wiki</UnderlineNav.Item></UnderlineNav>
Name | Type | Default | Description |
---|---|---|---|
aria-label | string | ||
aria-labelledby | string | ||
aria-describedby | string | ||
afterSelect | (event) => void | The handler that gets called when a nav link child is selected | |
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |
Name | Type | Default | Description |
---|---|---|---|
icon | Component | The leading icon comes before item label | |
selected | boolean | Whether the link is selected | |
onSelect | (event) => void | The handler that gets called when a nav link is selected | |
as | string | Component | a | What kind of component needs to be rendered |
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |