logo

SINGULARITY

DOCS

PurchaseReturn to the Dashboard
Reference

Links

The Link component enables seamless customization of anchor elements using your theme’s colors and typography styles.

Basic links

The Link component is built upon the Typography component, allowing you to utilize its properties.
Linkcolor="inherit"variant="body2"
The Link component, however, has distinct default properties compared to the Typography component:
  • color="primary" to ensure the link stands out prominently.
  • variant="inherit" since the link is typically used as a child of a Typography component.

Underline

The underline prop allows you to control the underline behavior, with always as the default setting.
underline="none"underline="hover"underline="always"

Security

When using target="_blank" with Links, it’s advised to always include rel="noopener" or rel="noreferrer" for links to third-party content.
  • rel="noopener" prevents the linked page from accessing the window.opener property and ensures it operates in a separate process, protecting against potential redirects to malicious URLs.
  • rel="noreferrer" provides the same protection while also suppressing the Referer header from being sent to the new page. ⚠️ Note that omitting the referrer header may impact analytics.

Third-party routing library

A common scenario is to enable client-side navigation without a server round-trip. The Link component supports this through the component prop. Refer to this detailed guide for more information.

Accessibility

  • Avoid vague link descriptions like “click here” or “go to” when providing link content. Instead, use descriptive text for clarity.
  • For optimal user experience, links should visually distinguish themselves from surrounding text. For example, you can retain the default underline="always" behavior.
  • If a link lacks a meaningful href, it should be rendered as a <button> element, as outlined in this guideline. The example below demonstrates proper linking with a <button>:

Keyboard accessibility

  • Interactive elements should receive focus in a logical sequence when the user presses the Tab key.
  • Users should be able to activate a link by pressing the Enter key.

Screen reader accessibility

  • When a link gains focus, screen readers should vocalize a clear and descriptive link name. For links opening in a new window or tab, include an aria-label to notify screen reader users—for example, “Visit the About page, which opens in a new window, for more details.”