IndiaCN UI

Typography

Styles for headings, paragraphs, lists...etc

Introduction

The Typography component library provides a complete set of text components following a systematic design scale. It includes display text, headlines, titles, labels, and body text components with predefined sizes and weights.

Installation

import { Display1, Headline1, Title1, Label1, Body1 } from '@/components/ui/typography';

Examples

H1

Taxing Laughter: The Joke Tax Chronicles

H1
import { Headline1 } from '@/components/ui/typography';

export default function Component() {
  return <Headline1>Taxing Laughter: The Joke Tax Chronicles</Headline1>;
}

H2

The People of the Kingdom

H2
import { Headline2 } from '@/components/ui/typography';

export default function Component() {
  return <Headline2>The People of the Kingdom</Headline2>;
}

H3

The Joke Tax

H3
import { Headline3 } from '@/components/ui/typography';

export default function Component() {
  return <Headline3>The Joke Tax</Headline3>;
}

Paragraph

The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax.

Paragraph
import { Body1 } from '@/components/ui/typography';

export default function Component() {
  return (
    <Body1>
      The king, seeing how much happier his subjects were, realized the error of
      his ways and repealed the joke tax.
    </Body1>
  );
}

Blockquote

everyone enjoys a good joke

Blockquote
import { Body1 } from '@/components/ui/typography';

export default function Component() {
  return (
    <blockquote className="border-l-4 border-zinc-300 pl-4 italic dark:border-zinc-700">
      <Body1>
        "After all," he said, "everyone enjoys a good joke, so it's only fair
        that they should pay for the privilege."
      </Body1>
    </blockquote>
  );
}

Table

King's Treasury

People's happiness

Empty

Overflowing

Modest

Satisfied

Full

Ecstatic

Table
import { Title2, Body2 } from '@/components/ui/typography';

export default function Component() {
  return (
    <div className="w-full overflow-auto">
      <table className="w-full">
        <thead>
          <tr className="border-b">
            <th className="h-12 px-4 text-left align-middle font-medium">
              <Title2>King's Treasury</Title2>
            </th>
            <th className="h-12 px-4 text-left align-middle font-medium">
              <Title2>People's happiness</Title2>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr className="border-b">
            <td className="p-4 align-middle"><Body2>Empty</Body2></td>
            <td className="p-4 align-middle"><Body2>Overflowing</Body2></td>
          </tr>
          <tr className="border-b">
            <td className="p-4 align-middle"><Body2>Modest</Body2></td>
            <td className="p-4 align-middle"><Body2>Satisfied</Body2></td>
          </tr>
          <tr>
            <td className="p-4 align-middle"><Body2>Full</Body2></td>
            <td className="p-4 align-middle"><Body2>Ecstatic</Body2></td>
          </tr>
        </tbody>
      </table>
    </div>
  );
}

List

  • 1st level of puns: 5 gold coins

  • 2nd level of jokes: 10 gold coins

  • 3rd level of one-liners : 20 gold coins

List
import { Body2 } from '@/components/ui/typography';

export default function Component() {
  return (
    <ul className="ml-6 list-disc [&>li]:mt-2">
      <li><Body2>1st level of puns: 5 gold coins</Body2></li>
      <li><Body2>2nd level of jokes: 10 gold coins</Body2></li>
      <li><Body2>3rd level of one-liners: 20 gold coins</Body2></li>
    </ul>
  );
}

Inline Code

Run the following command: npm install

Inline Code
import { Body1 } from '@/components/ui/typography';

export default function Component() {
  return (
    <Body1>
      Run the following command:{' '}
      <code className="relative rounded bg-zinc-100 px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold dark:bg-zinc-800">
        npm install
      </code>
    </Body1>
  );
}

Lead

A modal dialog that interrupts the user with important content and expects a response.

Lead
import { Display3 } from '@/components/ui/typography';

export default function Component() {
  return (
    <Display3 className="text-muted-foreground">
      A modal dialog that interrupts the user with important content and expects a response.
    </Display3>
  );
}

Large

Are you absolutely sure?

Large
import { Title1 } from '@/components/ui/typography';

export default function Component() {
  return <Title1>Are you absolutely sure?</Title1>;
}

Small

Email address
Small
import { Label1 } from '@/components/ui/typography';

export default function Component() {
  return <Label1>Email address</Label1>;
}

Muted

Enter your email address.

Muted
import { Body2 } from '@/components/ui/typography';

export default function Component() {
  return <Body2 className="text-muted-foreground">Enter your email address.</Body2>;
}

Component Reference

Display Components

Large text for hero sections and prominent titles (80px - 40px).

<Display1>80px Hero Title</Display1>
<Display2>72px Large Heading</Display2>
<Display3>64px Medium Heading</Display3>
<Display4>56px Feature Title</Display4>
<Display5>48px Section Heading</Display5>
<Display6>40px Card Title</Display6>

Headline Components

Semibold text for page and section headings (40px - 16px).

<Headline1>40px Main Heading</Headline1>
<Headline2>32px Section Heading</Headline2>
<Headline3>28px Subsection</Headline3>
<Headline4>24px Card Heading</Headline4>
<Headline5>20px Component Header</Headline5>
<Headline6>16px Small Heading</Headline6>

Title Components

Medium weight text for UI elements (22px - 14px).

<Title1>22px List Item Title</Title1>
<Title2>16px Button Text</Title2>
<Title3>14px Compact Title</Title3>

Label Components

Medium weight text for buttons and form labels (14px - 11px).

<Label1>14px Button Label</Label1>
<Label2>12px Small Button</Label2>
<Label3>11px Tiny Label</Label3>

Body Components

Normal weight text for content (16px - 12px).

<Body1>16px Main content text</Body1>
<Body2>14px Secondary content</Body2>
<Body3>12px Caption text</Body3>

Typography Scale

ComponentSizeWeightLine HeightUse Case
Display180px (5rem)Medium100pxHero sections
Display272px (4.5rem)Medium100pxLarge headings
Display364px (4rem)Medium80pxMedium headings
Display456px (3.5rem)Medium72pxFeature titles
Display548px (3rem)Medium56pxSection headings
Display640px (2.5rem)Medium48pxCard titles
Headline140px (2.5rem)Semibold48pxMain headings
Headline232px (2rem)Semibold40pxSection headings
Headline328px (1.75rem)Semibold32pxSubsections
Headline424px (1.5rem)Semibold28pxCard headings
Headline520px (1.25rem)Semibold24pxComponent headers
Headline616px (1rem)Semibold20pxSmall headings
Title122px (1.375rem)Medium28pxList items
Title216px (1rem)Medium24pxButtons, labels
Title314px (0.875rem)Medium20pxCompact titles
Label114px (0.875rem)Medium20pxButton text
Label212px (0.75rem)Medium16pxSmall buttons
Label311px (0.6875rem)Medium16pxTiny labels
Body116px (1rem)Normal24pxMain content
Body214px (0.875rem)Normal20pxSecondary content
Body312px (0.75rem)Normal16pxCaptions

Customization

All typography components accept standard HTML attributes and can be customized with className:

<Headline1 className="text-center text-primary mb-4">Centered Primary Heading</Headline1>

<Body1 className="italic text-gray-600">Italic gray text</Body1>

On this page