Theme
Customize appearance
Components
Typography
Build a consistent hierarchy using semantic text components.
View component source ↗Preview
A minimal example to get started.
A clear hierarchy
Consistent typography helps readers scan, understand, and act.
Keep supporting details quiet.
Installation
Install this component and its dependencies in a project initialized with shadcn.
pnpm dlx shadcn@latest add https://ui.hyunjoon.net/r/typography.jsonUsage
This is the basic example. Use the Code tab above for the selected example. Adjust import aliases to match your project.
import { TypographyH2, TypographyP, TypographyMuted } from "@/components/ui/typography";
export default function Example() {
return (
<div className="max-w-sm">
<TypographyH2>A clear hierarchy</TypographyH2>
<TypographyP>Consistent typography helps readers scan, understand, and act.</TypographyP>
<TypographyMuted>Keep supporting details quiet.</TypographyMuted>
</div>
);
}
API reference
Derived from the installed component types. Native DOM props are also supported where applicable. A dash means no explicit default is documented. Some props depend on the selected mode.
TypographyH1
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLHeadingElement> | undefinedReact.Ref<HTMLHeadingElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLHeadingElement, Element> | undefinedReact.ChangeEventHandler<HTMLHeadingElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLHeadingElement> | undefinedReact.KeyboardEventHandler<HTMLHeadingElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLHeadingElement> | undefinedReact.MouseEventHandler<HTMLHeadingElement> | undefined | — | Called when the element is activated. |
TypographyH2
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLHeadingElement> | undefinedReact.Ref<HTMLHeadingElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLHeadingElement, Element> | undefinedReact.ChangeEventHandler<HTMLHeadingElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLHeadingElement> | undefinedReact.KeyboardEventHandler<HTMLHeadingElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLHeadingElement> | undefinedReact.MouseEventHandler<HTMLHeadingElement> | undefined | — | Called when the element is activated. |
TypographyH3
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLHeadingElement> | undefinedReact.Ref<HTMLHeadingElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLHeadingElement, Element> | undefinedReact.ChangeEventHandler<HTMLHeadingElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLHeadingElement> | undefinedReact.KeyboardEventHandler<HTMLHeadingElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLHeadingElement> | undefinedReact.MouseEventHandler<HTMLHeadingElement> | undefined | — | Called when the element is activated. |
TypographyH4
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLHeadingElement> | undefinedReact.Ref<HTMLHeadingElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLHeadingElement> | undefinedReact.FocusEventHandler<HTMLHeadingElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLHeadingElement, Element> | undefinedReact.ChangeEventHandler<HTMLHeadingElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLHeadingElement> | undefinedReact.KeyboardEventHandler<HTMLHeadingElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLHeadingElement> | undefinedReact.MouseEventHandler<HTMLHeadingElement> | undefined | — | Called when the element is activated. |
TypographyP
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLParagraphElement> | undefinedReact.Ref<HTMLParagraphElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLParagraphElement, Element> | undefinedReact.ChangeEventHandler<HTMLParagraphElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLParagraphElement> | undefinedReact.KeyboardEventHandler<HTMLParagraphElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLParagraphElement> | undefinedReact.MouseEventHandler<HTMLParagraphElement> | undefined | — | Called when the element is activated. |
TypographyBlockquote
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLQuoteElement> | undefinedReact.Ref<HTMLQuoteElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLQuoteElement> | undefinedReact.FocusEventHandler<HTMLQuoteElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLQuoteElement> | undefinedReact.FocusEventHandler<HTMLQuoteElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLQuoteElement, Element> | undefinedReact.ChangeEventHandler<HTMLQuoteElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLQuoteElement> | undefinedReact.KeyboardEventHandler<HTMLQuoteElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLQuoteElement> | undefinedReact.MouseEventHandler<HTMLQuoteElement> | undefined | — | Called when the element is activated. |
TypographyList
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLUListElement> | undefinedReact.Ref<HTMLUListElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLUListElement> | undefinedReact.FocusEventHandler<HTMLUListElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLUListElement> | undefinedReact.FocusEventHandler<HTMLUListElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLUListElement, Element> | undefinedReact.ChangeEventHandler<HTMLUListElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLUListElement> | undefinedReact.KeyboardEventHandler<HTMLUListElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLUListElement> | undefinedReact.MouseEventHandler<HTMLUListElement> | undefined | — | Called when the element is activated. |
TypographyInlineCode
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLElement> | undefinedReact.Ref<HTMLElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLElement> | undefinedReact.FocusEventHandler<HTMLElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLElement> | undefinedReact.FocusEventHandler<HTMLElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLElement, Element> | undefinedReact.ChangeEventHandler<HTMLElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLElement> | undefinedReact.KeyboardEventHandler<HTMLElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLElement> | undefinedReact.MouseEventHandler<HTMLElement> | undefined | — | Called when the element is activated. |
TypographyLead
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLParagraphElement> | undefinedReact.Ref<HTMLParagraphElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLParagraphElement, Element> | undefinedReact.ChangeEventHandler<HTMLParagraphElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLParagraphElement> | undefinedReact.KeyboardEventHandler<HTMLParagraphElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLParagraphElement> | undefinedReact.MouseEventHandler<HTMLParagraphElement> | undefined | — | Called when the element is activated. |
TypographyLarge
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLDivElement> | undefinedReact.FocusEventHandler<HTMLDivElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLDivElement> | undefinedReact.FocusEventHandler<HTMLDivElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLDivElement, Element> | undefinedReact.ChangeEventHandler<HTMLDivElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLDivElement> | undefinedReact.KeyboardEventHandler<HTMLDivElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLDivElement> | undefinedReact.MouseEventHandler<HTMLDivElement> | undefined | — | Called when the element is activated. |
TypographySmall
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLElement> | undefinedReact.Ref<HTMLElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLElement> | undefinedReact.FocusEventHandler<HTMLElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLElement> | undefinedReact.FocusEventHandler<HTMLElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLElement, Element> | undefinedReact.ChangeEventHandler<HTMLElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLElement> | undefinedReact.KeyboardEventHandler<HTMLElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLElement> | undefinedReact.MouseEventHandler<HTMLElement> | undefined | — | Called when the element is activated. |
TypographyMuted
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLParagraphElement> | undefinedReact.Ref<HTMLParagraphElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
defaultChecked | boolean | undefinedboolean | undefined | — | Initial checked state for an uncontrolled control. |
defaultValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | Initial value for an uncontrolled component. |
className | string | undefinedstring | undefined | — | Additional CSS classes merged with the component styles. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control receives focus. |
onBlur | React.FocusEventHandler<HTMLParagraphElement> | undefinedReact.FocusEventHandler<HTMLParagraphElement> | undefined | — | Called when the control loses focus. |
onChange | React.ChangeEventHandler<HTMLParagraphElement, Element> | undefinedReact.ChangeEventHandler<HTMLParagraphElement, Element> | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | React.KeyboardEventHandler<HTMLParagraphElement> | undefinedReact.KeyboardEventHandler<HTMLParagraphElement> | undefined | — | Called when a key is pressed while this element is focused. |
onClick | React.MouseEventHandler<HTMLParagraphElement> | undefinedReact.MouseEventHandler<HTMLParagraphElement> | undefined | — | Called when the element is activated. |
Usage notes
Choose the heading level for document structure, not just appearance. Combine the exported paragraph and supporting-text styles as needed.