VayuUI

Typography

Vayu UI's typography system built on the Typography component — semantic font families, size scales, and color variants for consistent, accessible text.

Overview

The Typography component encapsulates Vayu UI's type system — three font families, a semantic size scale, and color variants — into a single, accessible API. Instead of manually applying Tailwind classes, use Typography subcomponents to get consistent, readable text.

npx vayu-ui add typography

Font Families

Vayu UI uses three font families, each with a specific purpose:

TierFontTailwind ClassUsage
PrimaryOswaldfont-primaryHeadings, labels, navigation
SecondaryMulishfont-secondaryBody text, descriptions, captions
TertiaryGeist Monofont-tertiaryCode, technical values, keyboard shortcuts

The Typography component selects the right font automatically — headings use font-primary, paragraphs use font-secondary. Override with the font prop when needed.

Primary font (Oswald) — headings and labels

Secondary font (Mulish) — body text and descriptions

Geist Mono — code and technical values
<Typography.P font="primary">Oswald for headings</Typography.P>
<Typography.P font="secondary">Mulish for body text</Typography.P>
<Typography.Code>npm install vayu-ui</Typography.Code>

Headings

Typography provides six heading levels (H1–H6), each with predefined sizes and weights that maintain visual hierarchy.

Size Scale

ComponentSizeWeight
Typography.H1text-4xl / sm:text-5xl / lg:text-6xlfont-bold
Typography.H2text-3xl / sm:text-4xl / lg:text-5xlfont-extrabold
Typography.H3text-2xl / sm:text-3xl / lg:text-4xlfont-semibold
Typography.H4text-xl / sm:text-2xl / lg:text-3xlfont-semibold
Typography.H5text-lg / sm:text-xl / lg:text-2xlfont-semibold
Typography.H6text-base / sm:text-lg / lg:text-xlfont-semibold

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
<Typography.H1>Heading 1 — Page Title</Typography.H1>
<Typography.H2>Heading 2 — Section Title</Typography.H2>
<Typography.H3>Heading 3 — Subsection</Typography.H3>
<Typography.H4>Heading 4 — Component</Typography.H4>
<Typography.H5>Heading 5 — Subcomponent</Typography.H5>
<Typography.H6>Heading 6 — Minor Heading</Typography.H6>

Paragraphs

Typography.P renders body text with relaxed line height, using the secondary font by default.

This is a paragraph. It uses the secondary font (Mulish) with a relaxed line height for optimal readability. The typography system ensures consistent spacing and sizing across your application.

This is a secondary paragraph with less emphasis.

This paragraph will be truncated with an ellipsis when it overflows its container, useful for single-line content in cards or lists.

<Typography.P>Default paragraph with relaxed line height.</Typography.P>
<Typography.P variant="secondary">Secondary paragraph for less emphasis.</Typography.P>
<Typography.P ellipsis>Long text truncated with ellipsis.</Typography.P>

Color Variants

All Typography components support semantic color variants through the variant prop:

VariantUsageToken
primaryDefault textcanvas-content
secondaryMuted/deemphasizedmuted-content
tertiarySubtle textsurface-content
errorError/validationdestructive
warningWarning/cautionwarning
infoInformationalinfo
successSuccess/confirmationsuccess
gradientBrand gradientbrand gradient

Error text variant

Success text variant

Warning text variant

Info text variant

Gradient Heading

<Typography.P variant="error">Error text</Typography.P>
<Typography.P variant="success">Success text</Typography.P>
<Typography.P variant="warning">Warning text</Typography.P>
<Typography.P variant="info">Info text</Typography.P>

<Typography.H3 variant="gradient">Gradient Heading</Typography.H3>

Labels

Typography.Label associates text with form controls using the htmlFor prop.

<Typography.Label htmlFor="email">Email Address</Typography.Label>
<Typography.Label htmlFor="password">Password</Typography.Label>

Code

Typography.Code renders inline code with syntax language hints and accessible labels.

Install with: npm install vayu-ui

TypeScript example: const x: string = "hello"

<Typography.Code>npm install vayu-ui</Typography.Code>
<Typography.Code codeLang="typescript">const x: string = "hello"</Typography.Code>

Typography.Link uses Next.js <Link> for internal paths and standard <a> for external URLs. External links automatically add rel="noopener noreferrer" and accessible announcements.

<Typography.Link href="/components">Internal Link</Typography.Link>
<Typography.Link href="https://example.com" target="_blank">
  External Link
</Typography.Link>

Call to Action

Typography.CTA renders prominent text for calls to action.

Get Started with Vayu UI

<Typography.CTA className="text-brand">Call to Action</Typography.CTA>

Font Loading

Vayu UI expects these fonts to be loaded. Add them to your project's font configuration:

Using Next.js Font Optimization

// app/layout.tsx
import { Oswald, Mulish, Geist_Mono } from 'next/font/google';

const oswald = Oswald({
  subsets: ['latin'],
  variable: '--font-primary',
});

const mulish = Mulish({
  subsets: ['latin'],
  variable: '--font-secondary',
});

const geistMono = Geist_Mono({
  subsets: ['latin'],
  variable: '--font-tertiary',
});

export default function RootLayout({ children }) {
  return (
    <html className={`${oswald.variable} ${mulish.variable} ${geistMono.variable}`}>
      <body>{children}</body>
    </html>
  );
}

Using CSS @font-face

/* In your global CSS */
@font-face {
  font-family: 'Oswald';
  src: url('/fonts/Oswald.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'Mulish';
  src: url('/fonts/Mulish.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMono.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

On this page