Typography Components
Text and Heading components
Typography Components
Typography components display text content with proper semantic structure.
Text
Displays paragraph text with optional formatting.
json
{
"type": "Text",
"content": "This is a paragraph of text."
} Properties
| Property | Type | Default | Description |
|---|---|---|---|
content | string | - | Text content (required) |
variant | default | muted | small | large | lead | default | Text style |
as | string | p | HTML element |
className | string | - | CSS classes |
Variants
json
{
"type": "Flex",
"direction": "column",
"gap": "1rem",
"children": [
{ "type": "Text", "variant": "lead", "content": "Lead text - larger, emphasized" },
{ "type": "Text", "variant": "large", "content": "Large text" },
{ "type": "Text", "variant": "default", "content": "Default text" },
{ "type": "Text", "variant": "small", "content": "Small text" },
{ "type": "Text", "variant": "muted", "content": "Muted text - subdued color" }
]
} Variant Reference
| Variant | Font Size | Color |
|---|---|---|
lead | 1.25rem | default |
large | 1.125rem | default |
default | 1rem | default |
small | 0.875rem | default |
muted | 0.875rem | muted |
Examples
With expression:
json
{
"type": "Text",
"content": "Welcome back, {{state.user.name}}! You have {{state.notifications}} new notifications."
} As a different element:
json
{
"type": "Text",
"as": "span",
"content": "Inline text"
} With styling:
json
{
"type": "Text",
"content": "Important notice",
"className": "font-bold text-blue-600"
} Multi-line (use array):
json
{
"type": "Container",
"children": [
{ "type": "Text", "content": "First paragraph with some content." },
{ "type": "Text", "content": "Second paragraph continues the explanation." }
]
} Heading
Semantic headings (h1-h6).
json
{
"type": "Heading",
"text": "Page Title",
"level": 1
} Properties
| Property | Type | Default | Description |
|---|---|---|---|
text | string | - | Heading text (required) |
level | 1-6 | 2 | Heading level (h1-h6) |
className | string | - | CSS classes |
Levels
json
{
"type": "Container",
"className": "space-y-4",
"children": [
{ "type": "Heading", "level": 1, "text": "Heading 1 - Page Title" },
{ "type": "Heading", "level": 2, "text": "Heading 2 - Section" },
{ "type": "Heading", "level": 3, "text": "Heading 3 - Subsection" },
{ "type": "Heading", "level": 4, "text": "Heading 4 - Minor" },
{ "type": "Heading", "level": 5, "text": "Heading 5 - Small" },
{ "type": "Heading", "level": 6, "text": "Heading 6 - Smallest" }
]
} Level Reference
| Level | Font Size | Weight |
|---|---|---|
| 1 | 2.25rem (36px) | Bold |
| 2 | 1.875rem (30px) | Semibold |
| 3 | 1.5rem (24px) | Semibold |
| 4 | 1.25rem (20px) | Semibold |
| 5 | 1rem (16px) | Semibold |
| 6 | 0.875rem (14px) | Semibold |
Examples
Dynamic heading:
json
{
"type": "Heading",
"level": 1,
"text": "{{state.user.name}}'s Dashboard"
} Styled heading:
json
{
"type": "Heading",
"level": 2,
"text": "Featured Products",
"className": "text-blue-600 border-b pb-2"
} With icon (using Flex):
json
{
"type": "Flex",
"align": "center",
"gap": "0.5rem",
"children": [
{ "type": "Icon", "name": "Settings" },
{ "type": "Heading", "level": 2, "text": "Settings" }
]
} Typography Patterns
Page Header Text
json
{
"type": "Container",
"className": "mb-8",
"children": [
{ "type": "Heading", "level": 1, "text": "Dashboard" },
{
"type": "Text",
"variant": "muted",
"content": "Welcome back! Here's an overview of your account."
}
]
} Section with Description
json
{
"type": "Container",
"className": "mb-6",
"children": [
{ "type": "Heading", "level": 2, "text": "Notifications" },
{
"type": "Text",
"variant": "muted",
"content": "Configure how you want to receive notifications and alerts."
}
]
} Card Title and Description
json
{
"type": "Card",
"content": {
"type": "Flex",
"direction": "column",
"gap": "0.5rem",
"children": [
{ "type": "Heading", "level": 3, "text": "Quick Actions" },
{ "type": "Text", "variant": "small", "content": "Common tasks and shortcuts" },
{ "type": "Divider", "className": "my-4" },
{ "...card content..." }
]
}
} Error Message
json
{
"type": "Flex",
"direction": "column",
"gap": "0.25rem",
"children": [
{
"type": "Text",
"content": "Something went wrong",
"className": "font-medium text-red-600"
},
{
"type": "Text",
"variant": "small",
"content": "{{state.error}}",
"className": "text-red-500"
}
]
} Empty State Text
json
{
"type": "Flex",
"direction": "column",
"align": "center",
"className": "py-12 text-center",
"children": [
{ "type": "Icon", "name": "FileText", "className": "w-12 h-12 text-gray-400 mb-4" },
{ "type": "Heading", "level": 3, "text": "No documents yet" },
{
"type": "Text",
"variant": "muted",
"content": "Upload your first document to get started."
}
]
} Inline Text Elements
json
{
"type": "Text",
"as": "span",
"content": "Status: ",
"className": "mr-1"
} Combined with Badge:
json
{
"type": "Flex",
"align": "center",
"gap": "0.5rem",
"children": [
{ "type": "Text", "as": "span", "content": "Status:" },
{ "type": "Badge", "text": "Active", "variant": "success" }
]
} Styling Tips
Font Weights
json
{ "className": "font-normal" } // 400
{ "className": "font-medium" } // 500
{ "className": "font-semibold" } // 600
{ "className": "font-bold" } // 700 Text Colors
json
{ "className": "text-gray-900" } // Default
{ "className": "text-gray-500" } // Muted
{ "className": "text-blue-600" } // Primary
{ "className": "text-green-600" } // Success
{ "className": "text-red-600" } // Error
{ "className": "text-yellow-600" } // Warning Text Alignment
json
{ "className": "text-left" }
{ "className": "text-center" }
{ "className": "text-right" } Line Height
json
{ "className": "leading-tight" } // 1.25
{ "className": "leading-normal" } // 1.5
{ "className": "leading-relaxed" } // 1.625 Truncation
json
{
"type": "Text",
"content": "Very long text that should be truncated...",
"className": "truncate max-w-xs"
} Multi-line truncation:
json
{
"type": "Text",
"content": "Long content...",
"className": "line-clamp-3"
} On This Page