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-cli@latest 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

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

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.

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

Labels

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

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.Link uses Next.js <Link> for internal paths and standard <a> for external URLs. External links automatically add rel="noopener noreferrer" and accessible announcements.

Call to Action

Typography.CTA renders prominent text for calls to action.

Get Started with Vayu UI


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