Typography

Link

Inline text link with consistent focus ring and underline behavior.

import { Link } from '@lostgradient/cinder';
typographylink
01

Overview

Reference usage

Inline text link with consistent focus ring and underline behavior.

Usage

svelte
<script lang="ts">
  import { Link } from '@lostgradient/cinder';
</script>

<!-- Links inside a text block must stay distinguishable without relying on color
     (WCAG 1.4.1 / axe link-in-text-block), so in-prose links use underline="always". -->
<p>
  Read the
  <Link href="/docs" underline="always">documentation</Link>
  for more details, or visit the
  <Link href="https://example.com" external underline="always">official site</Link>.
</p>

<!-- Underline/color variants shown as a standalone list (one link per row), not inside
     running prose. Outside a text block the hover/none treatments are an acceptable,
     intentional choice and don't trip axe's link-in-text-block rule. -->
<ul style="list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem;">
  <li><Link href="/pricing" underline="always">Always underlined</Link></li>
  <li><Link href="/pricing" underline="hover">Underline on hover</Link></li>
  <li><Link href="/pricing" underline="none">No underline</Link></li>
  <li><Link href="/pricing" color="inherit" underline="always">Inherits text color</Link></li>
  <li><Link href="/pricing" disabled>Disabled link</Link></li>
</ul>

variant="more" is the way out of a section or an empty row to the page that holds the rest, such as "Open Reviews" in a Section's actions: small regular text with a chevron after the words, on one line, so it never reads louder than the heading beside it. Its face is the text's own; under a coarse pointer it reaches a 44px hit area that takes no layout, as a compact button does.

The more label can include inline elements such as <code> and preserves the spaces around them.

Use touchTarget for a link that stands alone on one line, such as a workflow ID in a table cell or a description value. It reaches 24px with a mouse and 44px with a coarse pointer without padding the link or moving the line. When neighbouring hit areas overlap, the link later in DOM order receives the tap.

Guidance

Use When

  • Embedding a navigable link inside body text or prose content.

Avoid When

  • Navigating between pages in a sidebar or nav bar — use NavigationItem.
  • Leave touchTarget off for links that can wrap in prose.
  • Use Button variant="link" for an action.
Live preview

Link

02

When to use

Use when
  • Embedding a navigable link inside body text or prose content.
  • Using touchTarget instead of padding a link that stands alone on one line in a table cell or description value.
  • Linking to the rest of a section with a more label that can include inline elements such as code.
Avoid when
  • Navigating between pages in a sidebar or nav bar — use NavigationItem.
  • Leave touchTarget off for links that can wrap in prose.
  • Use Button variant="link" for an action.
03

Examples

Link

Inline text link with underline and color variants.

04

Props

Props for link
Name
Type
Default
Description
href text The URL the link points to. Optional ONLY because a disabled link renders a <span> with no href. For any enabled (non-disabled) link you must provide it — an <a> without href is not keyboard-focusable and is not exposed as a link to assistive technology, so an enabled Link without href is a bug, not a feature.
underline 'always' | 'hover' | 'none' 'hover' Controls text-decoration behavior. - 'always' — underline is always visible. - 'hover' — underline appears on hover and focus (default). - 'none' — underline is never shown.
color 'primary' | 'inherit' 'primary' Controls the link color. - 'primary' — uses the accent/primary color token. - 'inherit' — inherits the surrounding text color.
variant 'inline' | 'more' 'inline' The link's form. - 'inline' — a link in running text, at the text's own size and weight. - 'more' — a link out to the page that holds the rest, such as "Open Reviews" beside a section's title or at the end of an empty row: small regular text with a chevron after it, on one line, and a 44px hit area under a coarse pointer that takes no layout.
touchTarget boolean false Extends the hit area of a link that stands alone on one line, such as a table cell or description value, without adding padding. Leave it off for prose links that can wrap. The more variant already includes a larger hit area.
external boolean false When true, automatically adds target="_blank" and merges rel="noopener noreferrer" with any consumer-supplied rel. Consumer-supplied target is preserved if provided.
disabled boolean false When true, renders a <span aria-disabled="true"> instead of <a>. The href is not emitted and pointer-events are disabled. Use to show a link that is contextually unavailable without removing it from the visual layout.
target HTMLAnchorAttributes['target'] Forwarded to the rendered <a>. external supplies "_blank" only when no target is given.
rel HTMLAnchorAttributes['rel'] Forwarded to the rendered <a>. "noopener noreferrer" is merged in whenever the link opens in a new tab — external is true OR the resolved target is "_blank" (case-insensitive) — and the whole value is de-duplicated case-insensitively.
tabindex number
children required snippet The link text or composed content. Required.