COMPONENT · 02

Text

Typography with 8 sizes, 9 intent colors, heading and overline presets, and weight, font and line-height props. It renders a paragraph by default; pick another element, like a heading, with render.

  • @ui-sdk/react
  • class-variance-authority

Sizes

Display — The interface that takes off

2XL — Main heading

XL — Subheading

LG — Body large, for highlighted paragraphs

MD — Body default, the standard size

SM — Small text, for notes and labels

XS — Caption · tracking wide · ideal for metadata

2XS — Fine print and compact labels

Colors

Default — foreground

primary — primary text

secondary — secondary text

muted — muted text

primary-muted — primary at 60%

secondary-muted — secondary at 60%

info — informational

warning — warning

success — confirmation

error — attention

Variants and type props

variant sets a role preset; weight, font, leading and color adjust it. Reach for className only for layout, like margins.

Overline · section label

Heading — semibold, tight tracking

Body with relaxed leading, for longer paragraphs that need room to breathe between lines.

Medium weight · card titles and labels

font="mono" · metadata and code-like values

Inline text keeps its parent's size: size="inherit"

HTML element

render sets the element; size and color stay independent of it, so the document outline and the visual scale don't have to match.

p styled as 2xl — a heading-sized paragraph

span — inline text

Customization

Bold with tight tracking

Muted text + italic

Decorative underline

Inline badge

Installation

npx shadcn@latest add https://lanzate-ui.vercel.app/r/text.json

Usage

import { Text } from "@/components/ui/text"

// Default paragraph (size="md")
<Text>Standard body text.</Text>

// h1 with the display size
<Text render={<h1 />} size="display">
  The interface that takes off
</Text>

// Caption with an intent color
<Text render={<span />} size="xs" color="muted">
  Last updated: 2 min ago
</Text>

// Section label
<Text variant="overline" size="xs">Installation</Text>

// Section title
<Text render={<h2 />} variant="heading" size="display">
  One command and you're in orbit
</Text>

// Error message
<Text size="sm" color="error">
  This field is required.
</Text>

API

PropTypeDefaultDescription
renderReactElement | (props) => ReactElement<p />Element to render instead of <p>, like render={<h1 />}. Same render prop as ui-sdk parts.
size"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "display" | "inherit""md"Size from the type-scale tokens, with matching line height and tracking. "inherit" keeps the parent's size, for inline text.
variant"body" | "heading" | "overline""body"Role preset. heading: the heading font (--font-heading), semibold, tight tracking. overline: a small mono, uppercase, muted label.
weight"normal" | "medium" | "semibold"Font weight. Overrides the variant's.
font"sans" | "mono"Font family.
leading"none" | "tight" | "snug" | "normal" | "relaxed"Line height. Overrides the one the size sets.
color"primary" | "secondary" | "muted" | "primary-muted" | "secondary-muted" | "info" | "warning" | "success" | "error" | "inherit"Intent color. Overrides the variant's. Without it, the text uses the foreground color. `inherit` takes the parent's color, for text inside a control that colors its own states.
classNamestringClasses merged after the variants, so they can extend or override any base style.