Get Started
Components
- Accordion
- Alert Dialog
- Alert
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button Group
- Button
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Container
- Context Menu
- Data Table
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Flex
- Form
- Grid
- Hero Button
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Responsive
- Scroll Area
- Segmented Control
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spacer
- Spinner
- Squircle
- Switch
- Table
- Tabs
- Textarea
- Theme Toggle
- Toggle Group
- Toggle
- Tooltip
- Typography
- Unicorn Wrapper
Animations
- Background Image Parallax
- Card Swipe Carousel
- Cards Parallax
- Parallax Scroll
- Perspective Carousel
- Perspective Section Transition
- Scroll Expand
- Scroll Fade
- Scroll Scale
- Slide Down
- Slide Up
- Smooth Parallax Scroll
- Smooth Scroll
- Sticky Footer
- Text Along Path
- Text Gradient Opacity
- Text Parallax
- Transforms 3d
- Zoom Parallax
import Typography from "@/components/ui/typography"
export function TypographyComponentDemo() {
return (
<div className="space-y-6">
<Typography variant="h1">Heading 1</Typography>
<Typography variant="h2">Heading 2</Typography>
<Typography variant="h3">Heading 3</Typography>
<Typography variant="paragraph-lg">
This is a paragraph with the paragraph-lg variant. It uses CSS custom
properties for consistent typography across your application.
</Typography>
<Typography variant="label-md">
This is a label with label-md variant
</Typography>
</div>
)
}
Installation
pnpm dlx pitsi@latest add typography
Usage
import Typography from "@/components/ui/typography"<Typography variant="h1">Welcome to our platform</Typography>Examples
Headings
import Typography from "@/components/ui/typography"
export function TypographyHeadings() {
return (
<div className="space-y-3">
<Typography variant="h1">Heading 1</Typography>
<Typography variant="h2">Heading 2</Typography>
<Typography variant="h3">Heading 3</Typography>
<Typography variant="h4">Heading 4</Typography>
<Typography variant="h5">Heading 5</Typography>
<Typography variant="h6">Heading 6</Typography>
</div>
)
}
Paragraphs
import Typography from "@/components/ui/typography"
export function TypographyParagraphs() {
return (
<div className="space-y-4">
<Typography variant="paragraph-xl">
Paragraph XL - Large introductory text that draws attention.
</Typography>
<Typography variant="paragraph-lg">
Paragraph LG - Default body text for articles and main content.
</Typography>
<Typography variant="paragraph-md">
Paragraph MD - Component descriptions for cards and dialogs.
</Typography>
<Typography variant="paragraph-sm">
Paragraph SM - Small text for captions.
</Typography>
</div>
)
}
Labels
import Typography from "@/components/ui/typography"
export function TypographyLabels() {
return (
<div className="space-y-4">
<Typography variant="label-xl">
Label XL - Lead text and feature introductions
</Typography>
<Typography variant="label-lg">
Label LG - Important form labels and emphasis
</Typography>
<Typography variant="label-md">
Label MD - Standard form labels and UI labels
</Typography>
<Typography variant="label-sm">
Label SM - Small labels, badges, and metadata
</Typography>
<Typography variant="label-xs">
Label XS - Tiny indicators and micro copy
</Typography>
</div>
)
}
Polymorphic
import Typography from "@/components/ui/typography"
export function TypographyPolymorphic() {
return (
<div className="space-y-4">
<Typography
variant="paragraph-md"
as="a"
href="#"
className="text-primary hover:underline"
>
This is a paragraph rendered as a link
</Typography>
<div>
<Typography variant="label-md" as="label" htmlFor="email">
Email Address
</Typography>
<input
id="email"
type="email"
className="mt-1 block w-full rounded-md border px-3 py-2"
placeholder="you@example.com"
/>
</div>
</div>
)
}
Variants
The Typography component supports the following variants:
Headings
h1- Main page headingh2- Section headingh3- Subsection headingh4- Minor headingh5- Smaller headingh6- Smallest heading
Labels
label-xl- Extra large labellabel-lg- Large labellabel-md- Medium label (default)label-sm- Small labellabel-xs- Extra small label
Paragraphs
paragraph-xl- Extra large paragraphparagraph-lg- Large paragraphparagraph-md- Medium paragraph (default)paragraph-sm- Small paragraphparagraph-xs- Extra small paragraph
Subheadings
subheading-md- Medium subheading (uppercase)subheading-sm- Small subheading (uppercase)subheading-xs- Extra small subheading (uppercase)subheading-2xs- Tiny subheading (uppercase)
Documentation
doc-label- Documentation label textdoc-paragraph- Documentation paragraph text
Props
| Prop | Type | Default | Description |
|---|---|---|---|
as | React.ElementType | varies by variant | The element to render as |
variant | TypographyVariant | "paragraph-md" | The typography style to apply |
className | string | - | Additional classes |
style | React.CSSProperties | - | Additional inline styles |
Polymorphic Rendering
The Typography component is polymorphic and can be rendered as any HTML element:
// Render as a different element
<Typography variant="h1" as="div">
This is a div with h1 styling
</Typography>
// Use with semantic HTML
<Typography variant="label-md" as="label" htmlFor="input">
Form Label
</Typography>
// Render as a link
<Typography variant="paragraph-md" as="a" href="/about">
Learn more
</Typography>CSS Custom Properties
The Typography component uses CSS custom properties (CSS variables) for all typography styles. This allows for easy theming and customization across your entire application.
Each variant uses the following CSS variables:
--text-{variant}- Font size--text-{variant}--line-height- Line height--text-{variant}--letter-spacing- Letter spacing--text-{variant}--font-weight- Font weight
Examples
Hero Section
<Typography variant="h1">
Build faster with our design system
</Typography>
<Typography variant="paragraph-lg">
A comprehensive collection of components built with React and Tailwind CSS.
</Typography>Card Component
<div className="card">
<Typography variant="subheading-xs">Features</Typography>
<Typography variant="h3">Everything you need</Typography>
<Typography variant="paragraph-md">
All the tools you need to build modern web applications.
</Typography>
</div>Form Label
<Typography variant="label-sm" as="label" htmlFor="email">
Email Address
</Typography>
<input id="email" type="email" />Pricing Card
<div className="pricing-card">
<Typography variant="subheading-sm">Pro Plan</Typography>
<Typography variant="h2">
$29
<Typography variant="paragraph-sm" as="span">
/month
</Typography>
</Typography>
<Typography variant="paragraph-sm">Perfect for growing teams</Typography>
</div>Default Elements
Each variant has a default HTML element it renders as:
- Heading variants (
h1-h6) ā corresponding heading tags - Label variants ā
<span> - Paragraph variants ā
<p> - Subheading variants ā
<span> - Doc variants ā
<span>or<p>
You can override these with the as prop for semantic flexibility while maintaining consistent styling.