Typography Utilities

Font size, weight, alignment, and text transformation utilities for precise typography control.

Font Sizes

A consistent type scale from extra small to 4xl.

ClassValuePixelsPreview
text-xs0.75rem12pxThe quick brown fox
text-sm0.875rem14pxThe quick brown fox
text-base1rem16pxThe quick brown fox
text-lg1.125rem18pxThe quick brown fox
text-xl1.25rem20pxThe quick brown fox
text-2xl1.5rem24pxThe quick brown fox
text-3xl1.875rem30pxThe quick brown fox
text-4xl2.25rem36pxThe quick brown fox

Font Size Examples

Extra small text (12px)

Small text (14px)

Base text (16px)

Large text (18px)

Extra large text (20px)

2XL text (24px)

3XL text (30px)

4XL text (36px)

Font Weight

Control the thickness of text with font weight utilities.

Font Weights

Normal weight (400)

Medium weight (500)

Semibold weight (600)

Bold weight (700)

Text Alignment

Align text to the left, center, right, or justify.

Text Alignment

Left aligned text

Center aligned text

Right aligned text

Justified text that will wrap and align evenly on both sides when it spans multiple lines.

Text Transform

Transform text case with uppercase, lowercase, or capitalize utilities.

Text Transformations

uppercase text

LOWERCASE TEXT

capitalize each word

Normal Case Text

Text Decoration

Add or remove text decorations like underline and line-through.

Text Decorations

Underlined text

Strikethrough text

No underline text

Line Height

Control the vertical spacing between lines of text.

Line Heights

Tight line height. This text has reduced spacing between lines making it more compact. Good for headings.

Normal line height. This text has standard spacing between lines for comfortable reading. Good for body text.

Relaxed line height. This text has increased spacing between lines for better readability. Good for long-form content.

Text Truncation

Truncate text with ellipsis when it overflows.

Text Overflow

This is a very long text that will be truncated with an ellipsis when it overflows its container

This text will also truncate with ellipsis when too long

Common Patterns

Heading Hierarchy

Typography Hierarchy

Main Heading

Section Heading

Subsection Heading

Body text with relaxed line height for comfortable reading.

Small muted text for captions or secondary information.

Card Typography

Card with Typography Utilities

Article Title

Posted on Jan 15, 2024

This is the article excerpt that provides a preview of the content.

Read more →

Accessibility

Best Practices:
  • Use semantic HTML headings (h1-h6) for document structure
  • Maintain a logical heading hierarchy
  • Ensure minimum font size of 16px for body text
  • Use sufficient line height (1.5 or more) for readability
  • Avoid all-caps for long text passages
  • Don't rely solely on text formatting for meaning