A link (hyperlink) connects users to content in another location.
Problem
As a customer I need to access content available in another location.
Solution
Present the customer with a link that provides a meaningful description of the destination content.
Best Practice Guidance
By default links are underlined to ensure links are easily identifiable amongst other content.
All anchor elements must contain a valid href
Use succinct and meaningful link text.
Link text should match the title of the destination page or content.
Core attributes
core attributes of links
Text decoration
underline
Color
See the interactive colours in the Colour system. Interactive - var(--interactive) is the default colour.
Default size
1rem (16px)
Accessibility
Ensure contrast between link text and its associated background exceeds 4.5 to 1.
All anchor elements (links) must have a valid href attribute.
Use succinct and meaningful link text.
Provide additional context when link text is repeated for example: more, Edit. Use the VisuallyHidden component to apply additional context when the additional context needs to be hidden.
Use the ExternalLink component consistently for all external text links.
Show file type and size for links to non HTML content.
When linking content at the end of a sentence keep the full stop separate to the link.
Links or Buttons?
Button styles are available as both button elements or anchor elements, it is important to use the correct element based on the interaction.
While links and buttons can both be given similar visual treatments, it is important that a link is used for clicking an element that will navigate the user to a different page or content.
Buttons are for submitting forms or for interactions within in the current page.
Recommended usage for links:
Interactions that redirect to another page.
Interactions that shift focus to a section within the current page - using the ID (#) reference.
Actions that open new windows or tabs.
Recommended usage for buttons:
Submitting forms
Interactions within the page
Opening modal windows
Toggling states like accordions or expandable menus