# Link

A text link in the accent color. Link is Text rendered as an `<a>`: it takes every anchor attribute, a `ref`, and Text’s type props. Use [Button](https://design-system.blocks-ui.com/components/button.md) for actions; use Link for navigation.

```tsx
import { Link } from '@blocks/design-system'
```

## Usage

**Example: Links in a sentence** (`examples/link/inline.tsx`)

```tsx
import { Body, Link } from '@blocks/design-system'

export default function Inline() {
  return (
    <Body>
      Readings come from the{' '}
      <Link href="#station-network">station network</Link>
      . Muted links work for secondary details: <Link href="#methodology" color="text-muted">methodology</Link>.
    </Body>
  )
}
```

## Router links

Pass your router’s link component as `as` to keep client-side navigation and prefetching with the same styles. The package never imports a router: here `next/link` comes from the app.

**Example: Related pages** (`examples/link/related-pages.tsx`)

```tsx
import { Link, Stack } from '@blocks/design-system'
import NextLink from 'next/link'

export default function RelatedPages() {
  return (
    <Stack as="nav" aria-label="Related pages" gap="xs">
      {/* A native anchor: a full page load. */}
      <Link href="/components/box">Box, with a native link</Link>
      {/* next/link as the host: client-side navigation, same styles. */}
      <Link as={NextLink} href="/components/grid">
        Grid, with next/link
      </Link>
    </Stack>
  )
}
```

```tsx
import { Link } from '@blocks/design-system'
import NextLink from 'next/link'

<Link as={NextLink} href="/components/grid">Grid</Link>
```

## Props

**`Link` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | — | The element or component to render, e.g. `as={NextLink}`. |
| `color` | `"text" \| "overlay" \| "bg" \| "bg-subtle" \| "surface" \| "surface-hover" \| "surface-active" \| "selected" \| "border-subtle" \| "border" \| "border-strong" \| "focus-ring" \| "accent" \| "accent-hover" \| "accent-fg" \| "accent-subtle" \| "accent-text" \| "danger" \| "danger-hover" \| "danger-fg" \| "danger-subtle" \| "danger-text" \| "warning" \| "warning-hover" \| "warning-fg" \| "warning-subtle" \| "warning-text" \| "success" \| "success-hover" \| "success-fg" \| "success-subtle" \| "success-text" \| "info" \| "info-hover" \| "info-fg" \| "info-subtle" \| "info-text" \| "text-muted"` | `accent-text` | A color token. Defaults to `"text"`. |
| `fontFamily` | `"body" \| "heading" \| "monospace"` | — | A font token: `body`, `heading` or `monospace`. |
| `fontSize` | `"body" \| "code" \| "heading" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "xxl" \| "xxxl" \| "xxxxl" \| "xxxxxl" \| "inherit"` | `inherit` | A font size token, e.g. `"sm"` or `"heading"`, or `"inherit"` to keep the parent's size. Defaults to `"body"`. |
| `fontWeight` | `"body" \| "heading" \| "medium" \| "bold" \| "semibold"` | — | A font weight token: `body`, `medium`, `semibold`, `heading` or `bold`. |
| `lineHeight` | `"body" \| "heading" \| "inherit"` | `inherit` | `body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`. |

Also accepts [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches) and [margin props](https://design-system.blocks-ui.com/components/box.md#spacing), and the native attributes of the element it renders.

## Accessibility

- Link text should make sense out of context, since screen readers can list a page’s links. Avoid “click here”.
- The browser’s focus ring shows on keyboard focus; the optional reset draws it in the focus-ring color.
- Don’t rely on color alone inside body text: the default underline keeps links distinguishable.
