{{ field }} interpolation. Styles adapt automatically to dark mode.
Text Components
Prefab has a text component for every level of the visual hierarchy. They all share the same API: positional content, formatting kwargs (bold, italic, underline, etc.), andcss_class for anything else.
| Component | Purpose |
|---|---|
H1, H2, H3, H4 | Headings with decreasing size and weight |
Heading(level=n) | Dynamic heading level from a variable |
P | Standard paragraph text |
Lead | Larger, muted text for introductions |
Large | Emphasized text with bolder weight |
Small | Smaller text for metadata and fine print |
Muted | Secondary-color text for less prominent information |
Text | Unstyled span, the most flexible building block |
BlockQuote | Indented border for quotations |
Markdown | Renders markdown syntax (bold, links, lists, images) |
Inline Formatting
Modifiers
All text components accept formatting kwargs that compile to Tailwind classes:bold, italic, underline, strikethrough, uppercase, lowercase, and align.
Span and Link
Span is the inline formatting primitive. It carries all the same modifiers as Text, plus code for monospace styling and style for inline CSS. Link works the same way but renders as an anchor tag with href.
Pass mixed strings, Spans, and Links to Text as positional arguments. Strings auto-wrap as plain spans:
API Reference
Common Parameters
All text components share this interface:
Text content. Accepts
{{ field }} interpolation. Can be passed as a positional argument.Bold weight.
Italic style.
Underline decoration.
Strikethrough decoration.
Transform text to uppercase.
Transform text to lowercase.
Horizontal text alignment.
Additional Tailwind CSS classes.
Text
Accepts mixed positional args for inline formatting:
Heading
Heading level:
1 (h1), 2 (h2), 3 (h3), or 4 (h4).Protocol Reference
Text
Heading