Link
A link connects users to a different page or further information.
Default
Component Preview
This is a text link on a light background.
Component Code
<p> This is <a class="usa-link" href="javascript:void(0);">a text link</a> on a light background. </p>
Visited Link
Component Preview
This is a visited link.
Component Code
<p> This is <a class="usa-link usa-color-text-visited" href="javascript:void(0);">a visited link</a>. </p>
External Link (Current Tab)
Component Preview
This is a link that opens in the current tab and goes to an external website.
Component Code
<p> This is a link that opens in the <em>current</em> tab and goes to an <a class="usa-link usa-link--external" rel="noreferrer" href="https://designsystem.digital.gov/" >external website</a >. </p>
External Link (New Tab)
Component Preview
This is a link that opens in a new tab and goes to an external website.
Component Code
<p> This is a link that opens in a <em>new</em> tab and goes to an <a class="usa-link usa-link--external" rel="noreferrer" target="_blank" href="https://designsystem.digital.gov/" >external website</a >. </p>
Link on Dark Background
Component Preview
This is a text link on a dark background.
Component Code
<div class="usa-dark-background padding-2 display-inline-block"> <p> This is <a class="usa-link" href="javascript:void(0);">a text link on a dark background</a>. </p> </div>
Alternate External Link on Dark Background
Component Preview
This is an alternate external text link on a dark background.
Component Code
<div class="usa-dark-background padding-2 display-inline-block"> <p> <a class="usa-link usa-link--alt usa-link--external" rel="noreferrer" href="https://designsystem.digital.gov/" >This</a > is an alternate external text link on a dark background. </p> </div>
Guidance
When to use the link component
- Navigating to a new page or view.
- Use links to connect users to a different page or further information.
- Navigating to an external website.
- Use links with the external link indicator to show users they will leave your site.
When to consider something else
- Triggering an action.
- Use a button instead of a link when the user is performing an action, such as submitting a form or opening a modal.
Usability guidance
- Clearly identify external links.
- The external link icon is a good way to communicate that a link is external.
- Use unique, meaningful link text.
- Link text should explain the link's purpose and help the user understand the link's destination. Avoid vague text like "click here" or "read more".
- Simplify link placement in body text.
- A link requires mental effort, which affects readability. Reduce the number of links in a single sentence to simplify its message.
- Link directly to the most relevant page.
- Avoid links to pages that require further user action to locate the intended information.
- Indicate file type and size for non-HTML content.
- If you link to a file, tell users ahead of time if the link may trigger a file download, and show the size and format of that file.
- Write out email and phone links.
- For
mailto:andtel:links, write out email addresses and phone numbers so users can read or copy this information without selecting the link.
Accessibility guidance
- Allow keyboard navigation of links.
- Users should be able to navigate between links by using the "Tab" key. They should be able to activate a link by pressing the "Enter" key.
- Link hover state should be visible on focus.
- Users should be able to activate hover and focus states with both a mouse and a keyboard.
- Don't rely only on color to distinguish links.
- Include an underline or bottom border on text links, in addition to a consistent link color.
USWDS Documentation
For more guidance, view the USWDS Link Component Documentation.
Settings
| Variable | Description |
|---|---|
$theme-external-link-sr-label-tab-new
|
Screen reader label for external links that open in new tabs. |
$theme-external-link-sr-label-tab-same
|
Screen reader label for external links that open in current tab. |
Variants
| Variant | Description |
|---|---|
|
|
Display an external link icon after the link. |
|
|
Alternate link style for dark backgrounds. |
|
|
Applies visited link color styling. |