Link
Accessible inline link with sm/md/lg/inherit sizes, a focus ring, URL sanitisation, and an optional external-link icon.
Status: stable. Group: navigation. Markdown version: /design-system/components/link.md
When to use
Link is the inline navigation anchor. It sanitises the href (http, https, mailto, tel and relative paths only; javascript: and data: URLs are rewritten to #), auto-detects off-site destinations and appends an external-link icon plus a translated visually hidden "(external link)" suffix, and adds rel=noopener noreferrer to every link it classifies as external, whatever the target (a relative target=_blank link gets no added rel). Detection is by URL shape alone, identical on server and client so hydration never diverges: every absolute or protocol-relative http(s) URL counts as external, including one that points at the current site, so use a relative href for same-site links. Underline modes cover always, hover and none; sizes are sm, md, lg and inherit (follows the surrounding text size).
Use Link for navigation in body copy, lists, breadcrumbs and footers; the plain underline treatment is token-driven.
When not to use
- Do not use Link for actions. Buttons are for actions; anchors are for navigation.
- Do not override the underline via inline styles; the token-driven treatment owns it.
- Do not use underline=none for links in running text; an undecorated inline link loses its affordance.
Look-alikes
- Button: Do not build button-shaped CTAs from Link; use Button, with href when the destination is a page.
- NavLink: Do not use NavLink for inline body links; that is Link's job; NavLink's route tracking is navigation-chrome behavior.
- SocialIconLink: Do not put text children inside; this is icon-only; use Link for labeled links.
Props
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
size | "sm" | "md" | "lg" | "inherit" | md | Size. Defaults to md; inherit follows the surrounding text size. | No |
underline | "always" | "hover" | "none" | always | Underline mode. "always" shows it permanently, "hover" reveals it on hover and keyboard focus (nav lists like the site footer), "none" omits it entirely. Defaults to always. | No |
Variants
- Available sizes:
sm,md,lg,inherit(defaultmd). - Allowed
underlinevalues:always,hover,none(defaultalways).
Invalid combinations
The contract records no invalid combinations.
Keyboard
| Key | Behaviour |
|---|---|
| Enter | Activates the focused control. (standard) |
Rows marked (standard) name a key the contract lists without a description; the behaviour shown is the usual one for that key.
Rules
Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.
| Level | Rule | How it is checked |
|---|---|---|
| MUST | ARIA: Visible focus. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | ARIA: Descriptive link text. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | Required stories produce no axe violations at the configured severity. | Automated by npm run test:stories:matrix:ci. WCAG 2.5.8. |
| MUST | The accessibility tree (role, name, state) matches the committed snapshot for every required story. | Automated by npm run test:stories:matrix:ci. WCAG 1.3.1, 4.1.2. |
| MUST | The component remains legible and operable under a real browser forced-colors: active pass. | Automated by npm run test:stories:hc. |
| MUST | Every documented keyboard interaction works as specified. | Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2. |
| MUST | A human completed an end-to-end accessibility review of this component. | Manual review, last on 2026-11-04. |
| SHOULD | Let the component detect external destinations; the icon and rel handling are automatic. | Not stated in the contract. |
| SHOULD | Use underline=hover in dense link collections such as footer columns. | Not stated in the contract. |
| SHOULD NOT | Do not build button-shaped CTAs from Link; use Button, with href when the destination is a page. | Not stated in the contract. |
| SHOULD NOT | Do not compose raw anchors for dynamic hrefs to bypass the sanitiser; a pasted URL must never become an XSS surface. | Not stated in the contract. |
Install and import
- Install:
npm install @digitaltableteur/react(version 0.9.1, restricted access on npm). - Import:
import { Link } from "@digitaltableteur/react"; - Entry point:
@digitaltableteur/react/navigationexports it too. - Styles: import
@digitaltableteur/react/style.cssonce at the app boundary. - Also available as the custom element
<dt-link>; see the custom elements manifest.
Links
- Machine-readable contract (Design System Contract 1.0)
- Markdown version of this page
- Component index as JSON
- All components
- Source: The implementation lives in a private repository. This page, its Markdown twin and the contract are generated from it at build time and are the public source of truth.