Skip to main content

Link

Info:Navigation html svelte astro Success: coverage 12/12

A text hyperlink: the anchor primitive, in three emphasis variants with an automatic external-link affordance.

Live demo

live · @xoji/astro

Link

Three variants

Same link, three weights of presence — from "click me" to "barely there until you reach for it."

View documentation variant="default"

The primary link tone — accented, the obvious thing to click.

Privacy policy variant="muted"

Lower-contrast for secondary navigation and footers.

release notes variant="quiet"

Inherits surrounding text color until hovered — for links woven into prose.

In context

The quiet variant is built to live inside a paragraph.

xoji derives a whole register from a few anchors. Read the derivation model for the full architecture, or jump straight to the dimensional contract to see how components consume those tokens. Either way, the link stays out of the way until you want it.

External links

target="_blank" auto-adds the icon, a screen-reader hint, and safe rel .

Link is the styled <a> primitive: inline text that navigates, drawn in the link color with an offset underline and a token-colored focus ring. Three variants tune emphasis: default is the full-strength link, muted recedes into body text (underline only on hover) for in-prose and secondary nav, and quiet is the lowest-key treatment for dense footers and utility nav.

When target="_blank", Link automatically appends an external-link glyph, adds a screen-reader-only "(opens in a new tab)" hint, and sets rel="noopener noreferrer", handling security and accessibility without ceremony. Given no href, it degrades to inert text rather than rendering a broken anchor.

When to use

How this component composes with the rest of the set.

Use variant="muted" for in-prose links that shouldn't fight the surrounding text, and variant="quiet" for footer and utility nav.
Pair with Breadcrumb and nav layouts once they land; Link is the leaf they wrap.
For button-shaped links (filled or outlined), reach for Button with an href instead. Link is for inline text.

Props

5 props, straight from the manifest.

PropTypeDefaultBindingsDescription
variant LinkVariant
default muted quiet
default
html svelte astro
Emphasis level. `default` is the full link color; `muted` recedes; `quiet` is the lowest-key, for dense nav.
href string
html svelte astro
The destination URL. Without it, Link renders inert text and warns at runtime.
target string
html svelte astro
Standard anchor target. `_blank` triggers the external icon, the SR hint, and an automatic `rel`.
rel string
html svelte astro
Explicit `rel`. When unset and `target="_blank"`, defaults to `noopener noreferrer`.
externalIcon boolean
html svelte astro
Forces the external-link icon on or off, overriding the `target="_blank"` auto-detection.

Appearance

Variants

default

.xoji-link

The full-strength link: link color with a persistent offset underline.

muted

.xoji-link--muted

Recedes into body text: body-secondary color, underline only on hover, brightening to the link color.

quiet

.xoji-link--quiet

The lowest-key treatment for dense or utility nav: body-tertiary color, no underline until hover.

Sizes

md

default
.xoji-link

Links inherit their surrounding text size.

States

hover

.xoji-link:hover

Pointer over the link: color shifts toward the link/hover color and the underline appears or strengthens.

focus-visible

.xoji-link:focus-visible

Keyboard focus: a token-colored ring, plus a transparent outline that becomes real in forced-colors mode.

external

.xoji-link__external-icon

An external link (target="_blank"): appends the icon and the SR-only new-tab hint, and sets rel.

Anatomy

The named parts that make up the component, with their selectors.

link

.xoji-link

The anchor element (or inert span when hrefless) carrying the variant class and link styling.

--font-sans --link --border-thin --space-1 --radius-sm --duration-fast --ease-standard

external-icon

.xoji-link__external-icon

The inline SVG glyph appended after the label when the link opens in a new tab.

--space-1

sr-hint

.xoji-link__sr-only

The visually-hidden "(opens in a new tab)" text announced to screen readers for external links.

Tokens & coverage

What the component consumes, checked live against what the algorithm produces.

Success:fully covered 12/12 consumed tokens produced default register: 276 tokens

Live coverage check against the xoji-default register (derive(xojiDefault, { anchors })coverComponent(manifest, register)). Every token this component consumes must be a key the algorithm produces.

--border-normal --border-thin --duration-fast --ease-standard --fg-2 --fg-3 --font-sans --link --link-hover --radius-sm --ring --space-1

Slots

default
html svelte astro

The link text.

Accessibility

Renders a native <a> so keyboard and screen-reader link semantics come for free.
External links (target="_blank") get rel="noopener noreferrer" automatically and a visually-hidden "(opens in a new tab)" hint so the new-tab behavior is announced, not just shown.
The external-link glyph is decorative (aria-hidden); the new-tab meaning lives in the SR-only hint.
Without an href, Link renders inert text rather than a clickable-looking dead anchor, and warns at runtime in the custom element.
Focus is shown with a token ring and a transparent outline that the forced-colors base rule promotes to a real system outline.

Code

Variants and external links

Three emphasis variants, plus the automatic external-link affordance on target="_blank".

<xoji-link href="/docs">Read the docs</xoji-link>

<xoji-link href="https://example.com" target="_blank">External site</xoji-link>

<nav>
	<xoji-link variant="muted" href="/about">About</xoji-link>
	<xoji-link variant="quiet" href="/legal">Legal</xoji-link>
</nav>
<script lang="ts">
	import { Link } from "@xoji/svelte";
</script>

<Link href="/docs">Read the docs</Link>

<Link href="https://example.com" target="_blank">External site</Link>

<nav>
	<Link variant="muted" href="/about">About</Link>
	<Link variant="quiet" href="/legal">Legal</Link>
</nav>
---
import { Link } from "@xoji/astro";
---

<Link href="/docs">Read the docs</Link>

<Link href="https://example.com" target="_blank">External site</Link>

<nav>
	<Link variant="muted" href="/about">About</Link>
	<Link variant="quiet" href="/legal">Legal</Link>
</nav>