Skip to the content

Link

Link navigates to another page. It renders a native <a> by default; pass your router's link through as for SPA navigation. External URLs always render a native <a> that opens in a new tab with rel="noopener noreferrer".
Actions

When to use

Use when
  • The control takes the user somewhere else — another route, page or site.
  • A navigation target needs the look of a button — use Link.Button.
Avoid when
  • The control performs an action without navigating — use Button.
  • The control submits a form — use <Button type="submit">.

Usage

Pass the label as text or as children; children wins when both are set.

loading

as takes any link component; extra props (to, prefetch, replace) are forwarded to it.

import NextLink from 'next/link';
import { Link as RouterLink } from 'react-router-dom';
import { Link } from '@apollion-dsi/core/elements/link';

<Link as={NextLink} href="/profile" text="My profile" />
<Link as={RouterLink} to="/profile" text="My profile" />

An href starting with http(s)://, //, mailto:, tel: or sms: is external. Link then ignores as, renders a native <a>, forces target="_blank" and merges your rel after noopener noreferrer (lowercased, deduplicated). On an internal href, rel passes through unchanged.

<Link href="https://example.com" rel="nofollow" text="Source" />
// rel="noopener noreferrer nofollow", target="_blank"

Link.Button

Link.Button is a link with the look of a Button: same variant, color and size, same as and external-link handling. The linked variant drops the button padding and bold weight, so it aligns with text in breadcrumbs and quiet navigation.

<Link.Button as={NextLink} href="/login" text="Sign in" variant="contained" />
<Link.Button href="/" text="Home" variant="linked" size="small" />

Underline and color

A Link is underlined at rest, so it is never distinguished by color alone. In navigation chrome, pass textDecoration="none": the underline then appears only on hover and keyboard focus. Inside a Text, every plain link is underlined regardless of its own textDecoration; Link.Button is left out.

Read the privacy policy and the terms of use before you continue.

<Link href="/docs" textDecoration="none" text="Docs" />

The link color is raised to a readable contrast against the page background. On a brand band, pass the band's token as contrast (for example contrast="main") to use that surface's on-color instead.

Accessibility

  • Renders an <a> (or your router's link); keyboard focus and Enter work natively.
  • Write link text that names the destination — avoid "click here".
  • External links open a new tab; say so in the label when that matters to the user.
  • Under forced colors, Link.Button restores its focus outline with the system Highlight color; a plain Link keeps the native outline.

Properties

See also