Skip to content

@vibe-labs/design-typography

Typography tokens and utility classes for the Vibe Design System — font families, sizes, weights, tracking, leading, alignment, decoration, and overflow utilities.

Installation

css
@import "@vibe-labs/design-typography";

Tokens

All tokens defined in @layer vibe.tokens.

Font Families

TokenDefault
--font-sansSystem UI stack
--font-monoMonospace stack
--font-display--font-sans

Text Colors

TokenDefault
--text-primary--color-neutral-0
--text-secondary--color-neutral-200
--text-inverse--color-neutral-900
--text-muted--color-neutral-400
--text-disabled--color-neutral-500

Font Sizes (with paired line heights)

TokenSizeLine height
--text-xs0.75rem1rem
--text-sm0.875rem1.25rem
--text-base1rem1.5rem
--text-md1.125rem1.625rem
--text-lg1.25rem1.75rem
--text-xl1.5rem2rem
--text-display-sm1.875rem2.25rem
--text-display-md2.25rem2.5rem
--text-display-lg3rem3.25rem
--text-display-xl3.75rem4rem
--text-hero4.5rem4.75rem
--text-hero-lg6rem6.25rem
--text-hero-xl7.5rem7.75rem

Standalone Leading

--leading-none (1) · --leading-tight (1.15) · --leading-snug (1.3) · --leading-normal (1.5) · --leading-relaxed (1.625) · --leading-loose (2)

Font Weights

--font-light (300) · --font-normal (400) · --font-medium (500) · --font-semibold (600) · --font-bold (700) · --font-black (900)

Letter Spacing

--tracking-tighter (-0.05em) · --tracking-tight (-0.025em) · --tracking-normal (0) · --tracking-wide (0.025em) · --tracking-wider (0.05em) · --tracking-widest (0.1em)

Utilities / Generated Classes

All classes generated into @layer vibe.utilities.

Sizes (sizes.g.css)

.text-{size} — sets both font-size and paired line-height

Sizes: xs · sm · base · md · lg · xl · display-sm · display-md · display-lg · display-xl · hero · hero-lg · hero-xl

Weights (weights.g.css)

.font-{weight}light · normal · medium · semibold · bold · black

Tracking (tracking.g.css)

.tracking-{name}tighter · tight · normal · wide · wider · widest

Leading (leading.g.css)

.leading-{name}none · tight · snug · normal · relaxed · loose

Families (families.g.css)

.font-sans · .font-mono · .font-display

Alignment (align.g.css)

.text-left · .text-center · .text-right · .text-justify

Decoration & Transform (decoration.g.css)

  • Decoration: .underline · .overline · .line-through · .no-underline
  • Transform: .uppercase · .lowercase · .capitalize · .normal-case

Overflow & Wrapping (overflow.g.css)

  • .truncate — single-line ellipsis
  • .text-wrap · .text-nowrap
  • .text-balance · .text-pretty — with @supports fallbacks
  • .line-clamp-1.line-clamp-4 — multi-line truncation

Dist Structure

FileDescription
index.cssBarrel — imports all files below
typography.cssToken definitions
sizes.g.cssFont size + line height utilities
weights.g.cssFont weight utilities
tracking.g.cssLetter spacing utilities
leading.g.cssLine height utilities
families.g.cssFont family utilities
align.g.cssText alignment utilities
decoration.g.cssDecoration & transform utilities
overflow.g.cssTruncation & wrapping utilities

Dependencies

Requires --color-neutral-* tokens from @vibe-labs/design-colors for text color tokens.

Build

bash
npm run build

Usage Guide

Provides font size, weight, tracking, leading, family, alignment, and overflow utilities for consistent text styling across the Vibe Design System.

Import

css
@import "@vibe-labs/design-typography";

Common Patterns

1. Body text with readable line height

html
<p class="text-base leading-relaxed">
  Body copy reads best at base size with relaxed leading.
</p>

2. Display heading with tight tracking

html
<h1 class="text-display-lg font-bold tracking-tight">
  Landing Page Headline
</h1>

3. Metadata and labels

html
<span class="text-xs font-medium uppercase tracking-wider text-muted">
  Category Label
</span>

4. Truncate long strings in constrained containers

html
<div class="truncate" style="max-width: 200px;">
  A very long filename or URL that must not overflow its container
</div>

5. Multi-line clamping for card descriptions

html
<p class="line-clamp-3 text-sm leading-normal">
  This description will show exactly three lines of text and then trail off
  with an ellipsis, regardless of the actual content length.
</p>

6. Switch font families for code blocks

html
<pre class="font-mono text-sm">
  <code>const x = useToken('--text-base');</code>
</pre>

7. Balance headlines to avoid awkward orphans

html
<h2 class="text-display-md font-semibold text-balance">
  A Nicely Balanced Two-Line Headline
</h2>

Token Reference

TokenValueLine height
--text-xs0.75rem1rem
--text-sm0.875rem1.25rem
--text-base1rem1.5rem
--text-md1.125rem1.625rem
--text-lg1.25rem1.75rem
--text-xl1.5rem2rem
--text-display-sm1.875rem2.25rem
--text-display-md2.25rem2.5rem
--text-display-lg3rem3.25rem
--text-hero4.5rem4.75rem

Vibe