Blocks Design System

Typography

Text, Heading, Body and BodySmall set text from the font, size, weight, line-height and color tokens. Each renders on the server. The element is chosen separately from the size, so the document outline stays correct whatever the visual design.

tsx
import { Body, BodySmall, Heading, Text } from '@blocks/design-system'

An article

Station guide

Each station reports snow depth, water content and temperature. Readings arrive hourly and are checked against nearby stations before they appear here.

Snow depth

Depth is measured by an ultrasonic sensor above a level board. Sudden drops usually mean wind, not melt.

Sensor accuracy is about half an inch.

Water content

Snow water equivalent is the depth of water the snowpack would make if it all melted at once.

Source · typography/station-guide.tsx
typography/station-guide.tsx
import { Body, BodySmall, Heading, Measure, Text } from '@blocks/design-system'

export default function StationGuide() {
  return (
    <Measure as="article" aria-labelledby="guide-title" marginX="none">
      <Heading as="h2" id="guide-title" fontSize="xl">
        Station guide
      </Heading>
      <Body>
        Each station reports snow depth, water content and temperature. Readings arrive hourly and are checked against
        nearby stations before they appear here.
      </Body>
      <Heading as="h3" fontSize="lg">
        Snow depth
      </Heading>
      <Body>
        Depth is measured by an ultrasonic sensor above a level board. <Text fontWeight="semibold">Sudden drops</Text>{' '}
        usually mean wind, not melt.
      </Body>
      <BodySmall color="text-muted">Sensor accuracy is about half an inch.</BodySmall>
      <Heading as="h3" fontSize="lg">
        Water content
      </Heading>
      <Body>Snow water equivalent is the depth of water the snowpack would make if it all melted at once.</Body>
    </Measure>
  )
}
Station guide

Text

Text is the base the others build on. It renders a <span> unless you pass as, and takes fontSize, fontWeight, fontFamily, lineHeight and color tokens plus margin props. Colors are semantic tokens such as text-muted and danger-text, which stay readable in both themes.

Storm total 18 inSince Tuesday eveningSTN-651 · 05:00 UTCAvalanche warning in effect
Source · typography/text-tokens.tsx
typography/text-tokens.tsx
import { Stack, Text } from '@blocks/design-system'

export default function TextTokens() {
  return (
    <Stack gap="xs">
      <Text fontSize="xl" fontWeight="bold">
        Storm total 18 in
      </Text>
      <Text color="text-muted">Since Tuesday evening</Text>
      <Text fontFamily="monospace" fontSize="sm">
        SNOTEL 651:OR:SNTL
      </Text>
      <Text color="danger-text" fontWeight="medium">
        Avalanche warning in effect
      </Text>
    </Stack>
  )
}
Text tokens

Headings

Heading renders an <h3> in the heading font, size and weight unless you pass as (h1–h6 or span). Pick the level for the outline and fontSize for the look. A span gives heading styling to text that should not appear in the outline. Themes change heading type through --ds-font-heading.

A second-level heading at the lg size

A third-level heading at the xxl size

A heading style on a span, outside the outline
Source · typography/heading-levels.tsx
typography/heading-levels.tsx
import { Heading, Stack } from '@blocks/design-system'

export default function HeadingLevels() {
  return (
    <Stack gap="sm">
      <Heading as="h2" fontSize="lg">
        A second-level heading at the lg size
      </Heading>
      <Heading as="h3" fontSize="xxl">
        A third-level heading at the xxl size
      </Heading>
      <Heading as="span" fontSize="md" color="text-muted">
        A heading style on a span, outside the outline
      </Heading>
    </Stack>
  )
}
Levels and sizes

Body text

Body is a paragraph at the md size and BodySmall one at sm, for captions, notes and secondary details. Pass as="span" for inline text.

Props

Text 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"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"bodyA 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"body`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.

Heading props
PropTypeDefaultDescription
asElementTypeh3A heading level from `"h1"` to `"h6"`, or `"span"`. Defaults to `"h3"`.
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"—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"—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"—`body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`.

Also accepts styling escape hatches, margin props and a ref, and the native attributes of the element it renders.

Body props
PropTypeDefaultDescription
asElementTypep`"p"` or `"span"`. Defaults to `"p"`.
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"—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"—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"—`body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`.

Also accepts styling escape hatches, margin props and a ref, and the native attributes of the element it renders.

BodySmall props
PropTypeDefaultDescription
asElementTypep`"p"` or `"span"`. Defaults to `"p"`.
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"—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"—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"—`body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`.

Also accepts styling escape hatches, margin props and a ref, and the native attributes of the element it renders.

Accessibility

  • Use one h1 per page and don’t skip levels: screen reader users move through a page by its headings.
  • Don’t rely on color alone to carry meaning, as in the warning above, which also says “warning”.
  • Sizes are rem-based tokens, so text grows with the reader’s font-size setting.