Blocks Design System

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 for actions; use Link for navigation.

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

Usage

Readings come from the station network. Muted links work for secondary details: methodology.

Source · link/inline.tsx
link/inline.tsx
import { Body, Link } from '@blocks/design-system'

export default function Inline() {
  return (
    <Body>
      Readings come from the{' '}
      <Link href="https://www.nrcs.usda.gov/resources/data-and-reports/snow-and-climate-monitoring-predictive-maps" rel="noreferrer">
        SNOTEL network
      </Link>
      . Muted links work for secondary details: <Link href="#methodology" color="text-muted">methodology</Link>.
    </Body>
  )
}
Links in a sentence

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.

Source · link/related-pages.tsx
link/related-pages.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>
  )
}
Related pages
tsx
import { Link } from '@blocks/design-system'
import NextLink from 'next/link'

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

Props

Link props
PropTypeDefaultDescription
asElementType—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-textA 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"inheritA 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 and margin props, 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.