Typography

Mocha's type scale, rendered by Mocha. Components set their text with it, and nothing else sets a size or weight: use Text or its textVariants.

Scale

Preview
scale.tsx
import { Inline } from "~/components/ui/inline"
import { Stack } from "~/components/ui/stack"
import { Text, textSizes } from "~/components/ui/text"

export default function Example() {
  return (
    <Stack gap="md" className="w-full">
      {textSizes.map((size) => (
        <Inline key={size} gap="xl" align="baseline" wrap={false}>
          <Text render={<span />} size="xs" family="mono" tone="muted" className="w-16 shrink-0">
            {size}
          </Text>
          <Text render={<span />} size={size} truncate className="min-w-0">
            The harbor plan, explained
          </Text>
        </Inline>
      ))}
    </Stack>
  )
}

Weights and families

Preview
styles.tsx
import { Text } from "~/components/ui/text"

const weights = ["normal", "medium", "semibold"] as const
const families = ["body", "heading", "mono"] as const

export default function Example() {
  return (
    <div className="grid w-full gap-xl sm:grid-cols-2">
      <div className="grid gap-sm">
        {weights.map((weight) => (
          <Text key={weight} size="lg" weight={weight}>
            {weight}
          </Text>
        ))}
      </div>
      <div className="grid gap-sm">
        {families.map((family) => (
          <Text key={family} size="lg" family={family}>
            {family}
          </Text>
        ))}
      </div>
    </div>
  )
}

Fonts

The font tokens in Mocha's theme. The heading family uses --heading-font; text without a family uses --body-font.

TokenValue
--body-font"Montserrat Variable", ui-sans-serif, system-ui, sans-serif
--heading-font"Baskervville Variable", ui-serif, Georgia, serif
--mono-font"PT Mono", ui-monospace, monospace