Skip to content

Text

CSS utility classes to style text. It is recommended that you first look at the h-text component and use that if possible.

Class names

Text size classes also support responsive prefixes sm:, md:, lg:, and xl: (e.g. md:text-lg). Responsive variants do not support the ! modifier.

ClassDescription! support
text-xsExtra small text (0.75rem / 12px).Yes
text-smSmall text (0.875rem / 14px). Common for labels and secondary content.Yes
text-baseDefault body text size (1rem / 16px).Yes
text-lgLarge text (1.125rem / 18px).Yes
text-xlExtra large text (1.25rem / 20px).Yes
text-2xl1.5rem / 24px.Yes
text-3xl1.875rem / 30px.Yes
text-4xl2.25rem / 36px.Yes
text-5xl3rem / 48px.Yes
text-6xl3.75rem / 60px.Yes
text-7xl4.5rem / 72px.Yes
text-8xl6rem / 96px.Yes
text-9xl8rem / 128px.Yes
ClassDescription
text-leftAligns text to the left edge of its container.
text-rightAligns text to the right edge of its container.
text-centerCenters text horizontally within its container.
text-justifyStretches each line to fill the full width of its container.
text-ellipsisSets text-overflow: ellipsis. Requires overflow-hidden and whitespace-nowrap.
text-wrapAllows text to wrap onto multiple lines when it exceeds the container width.
text-nowrapPrevents text from wrapping.
ClassDescription! support
font-extraboldExtra bold weight (800). Maximum emphasis.Yes
font-boldBold weight (700). Strong visual emphasis.Yes
font-semiboldSemi-bold weight (600). Moderate emphasis.Yes
font-mediumMedium weight (500). Slightly heavier than normal.Yes
font-normalNormal/regular weight (400). The default body weight.Yes
font-lightLight weight (300). Thinner strokes, softer appearance.Yes
ClassDescription! support
font-sansApplies the application's sans-serif typeface. Standard choice for UI and body text.Yes
font-serifApplies the application's serif typeface. Suited for headings and editorial content.Yes
font-monoApplies the application's monospace typeface. Used for code, paths, and technical strings.Yes
ClassDescription! support
leading-noneline-height: 1 — no extra space between lines.Yes
leading-tightline-height: var(--leading-tight) (1.2).Yes
leading-normalline-height: var(--leading-normal)Yes
leading-snugline-height: var(--leading-snug)Yes
leading-relaxedline-height: var(--leading-relaxed)Yes
leading-4line-height: calc(var(--spacing) * 4)Yes
leading-5line-height: calc(var(--spacing) * 5)Yes
leading-6line-height: calc(var(--spacing) * 6)Yes
leading-7line-height: calc(var(--spacing) * 7)Yes
leading-8line-height: calc(var(--spacing) * 8)Yes
ClassDescription
italicRenders text in italic style.
underlineUnderlines the text (text-decoration: underline).
no-underlineRemoves text underline (text-decoration: none).
line-throughStrikes through the text (text-decoration: line-through).
uppercaseTransforms all characters to uppercase.
lowercaseTransforms all characters to lowercase.
capitalizeCapitalizes the first letter of each word.
truncateCombines overflow: hidden, text-overflow: ellipsis, and white-space: nowrap in one class.
align-middleSets vertical-align: middle. Aligns an inline element to the middle of the surrounding text.
whitespace-nowrapPrevents text from wrapping, equivalent to white-space: nowrap.
whitespace-prePreserves whitespace and newlines; text does not wrap (white-space: pre).
whitespace-pre-wrapPreserves whitespace and newlines; text wraps normally (white-space: pre-wrap).

Examples

Text size

html
<p class="text-xs">Extra small</p>
<p class="text-sm">Small</p>
<p class="text-base">Base</p>
<p class="text-lg">Large</p>
<p class="text-xl">Extra large</p>
<p class="text-2xl">Extra large (x2)</p>
<p class="text-3xl">Extra large (x3)</p>
<p class="text-4xl">Extra large (x4)</p>
<p class="text-5xl">Extra large (x5)</p>
<p class="text-6xl">Extra large (x6)</p>
<p class="text-7xl">Extra large (x7)</p>
<p class="text-8xl">Extra large (x8)</p>
<p class="text-9xl">Extra large (x9)</p>

Line Height

html
<p class="leading-none">...</p>
<p class="leading-tight">...</p>
<p class="leading-snug">...</p>
<p class="leading-relaxed">...</p>
<p class="leading-4">...</p>
<p class="leading-6">...</p>
<p class="leading-8">...</p>