Navigation link
Importing
Add rh-navigation-link to your page with this import statement:
<script type="module">
import '@rhds/elements/rh-navigation-link/rh-navigation-link.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Usage
<rh-navigation-link href="#link">Link</rh-navigation-link>
<rh-navigation-link><a href="#link">Slotted a href Link</a></rh-navigation-link>
<rh-navigation-link icon="auto-light-dark-mode" icon-set="ui" href="#ai">Containers</rh-navigation-link>
<script type="module">
import '@rhds/elements/rh-navigation-link/rh-navigation-link.js';
</script>
Copy to Clipboard
Copied!
Wrap lines
Overflow lines
rh-navigation-link
Navigation Link provides a link for use within Red Hat navigation
components. It must be a child of elements like rh-subnav or
rh-navigation-primary that provide the parent list context. Authors
should set href or slot an <a> element directly; authors must not
slot a <button>. When current-page is set, aria-current="page" is
applied so screen readers announce the active page. Uses
delegatesFocus so Tab focus passes to the anchor.
Theming
This element uses Red Hat design system theming and can be used in themable contexts.
Slots
2
| Slot Name | Summary | Description |
|---|---|---|
icon, only rendered when |
Use instead of the |
|
Link content |
When the |
Attributes
4
| Attribute | DOM Property | Description | Type | Default |
|---|---|---|---|---|
|
|
icon |
Shorthand for the |
|
|
|
|
iconSet |
Icon set for the |
|
|
|
|
href |
The URL to navigate to when the link is clicked |
|
|
|
|
currentPage |
Indicates that this link refers to the current page for accessibility; used with the |
|
|
Methods
1
| Method Name | Description |
|---|---|
|
|
Events
0
None
CSS Shadow Parts
0
None
CSS Custom Properties
0
None
Design Tokens
4
| Token | Description | Copy |
|---|---|---|
--rh-color-text-primary
|
Link text color |
|
--rh-color-interactive-primary-default
|
Focus outline color |
|
--rh-border-width-md
|
Focus outline width 2px border width: Example: Alert |
|
--rh-border-radius-default
|
Focus border radius 3px border radius; Example: Card |
|
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.