|
| 1 | +--- |
| 2 | +title: "Text" |
| 3 | +description: "Display text with standardized typography styles" |
| 4 | +--- |
| 5 | + |
| 6 | +import { ComponentDemo, DemoGrid } from '@/app/components/ComponentDemo'; |
| 7 | + |
| 8 | +# Text |
| 9 | + |
| 10 | +The Text component displays text content with predefined typography variants. |
| 11 | + |
| 12 | +## Basic Usage |
| 13 | + |
| 14 | +<ComponentDemo |
| 15 | + schema={{ |
| 16 | + type: 'text', |
| 17 | + content: 'Hello, World!' |
| 18 | + }} |
| 19 | + title="Simple Text" |
| 20 | + description="Basic text without any styling" |
| 21 | +/> |
| 22 | + |
| 23 | +## Variants |
| 24 | + |
| 25 | +<DemoGrid> |
| 26 | + <ComponentDemo |
| 27 | + schema={{ |
| 28 | + type: 'text', |
| 29 | + content: 'Heading 1', |
| 30 | + variant: 'h1' |
| 31 | + }} |
| 32 | + title="Heading 1" |
| 33 | + /> |
| 34 | + <ComponentDemo |
| 35 | + schema={{ |
| 36 | + type: 'text', |
| 37 | + content: 'Heading 2', |
| 38 | + variant: 'h2' |
| 39 | + }} |
| 40 | + title="Heading 2" |
| 41 | + /> |
| 42 | + <ComponentDemo |
| 43 | + schema={{ |
| 44 | + type: 'text', |
| 45 | + content: 'Heading 3', |
| 46 | + variant: 'h3' |
| 47 | + }} |
| 48 | + title="Heading 3" |
| 49 | + /> |
| 50 | + <ComponentDemo |
| 51 | + schema={{ |
| 52 | + type: 'text', |
| 53 | + content: 'Paragraph text', |
| 54 | + variant: 'p' |
| 55 | + }} |
| 56 | + title="Paragraph" |
| 57 | + /> |
| 58 | + <ComponentDemo |
| 59 | + schema={{ |
| 60 | + type: 'text', |
| 61 | + content: 'Lead text for introductions', |
| 62 | + variant: 'lead' |
| 63 | + }} |
| 64 | + title="Lead" |
| 65 | + /> |
| 66 | + <ComponentDemo |
| 67 | + schema={{ |
| 68 | + type: 'text', |
| 69 | + content: 'Large text', |
| 70 | + variant: 'large' |
| 71 | + }} |
| 72 | + title="Large" |
| 73 | + /> |
| 74 | + <ComponentDemo |
| 75 | + schema={{ |
| 76 | + type: 'text', |
| 77 | + content: 'Small text', |
| 78 | + variant: 'small' |
| 79 | + }} |
| 80 | + title="Small" |
| 81 | + /> |
| 82 | + <ComponentDemo |
| 83 | + schema={{ |
| 84 | + type: 'text', |
| 85 | + content: 'Muted text', |
| 86 | + variant: 'muted' |
| 87 | + }} |
| 88 | + title="Muted" |
| 89 | + /> |
| 90 | +</DemoGrid> |
| 91 | + |
| 92 | +## Schema |
| 93 | + |
| 94 | +```typescript |
| 95 | +interface TextSchema { |
| 96 | + type: 'text'; |
| 97 | + content: string; // Text content to display |
| 98 | + value?: string; // Alias for content |
| 99 | + variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'lead' | 'large' | 'small' | 'muted'; |
| 100 | + align?: 'left' | 'center' | 'right' | 'justify'; |
| 101 | + color?: string; // Tailwind color class |
| 102 | + className?: string; // Additional CSS classes |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +## Examples |
| 107 | + |
| 108 | +### Colored Text |
| 109 | + |
| 110 | +<ComponentDemo |
| 111 | + schema={{ |
| 112 | + type: 'flex', |
| 113 | + gap: 4, |
| 114 | + children: [ |
| 115 | + { type: 'text', content: 'Primary Text', color: 'text-primary' }, |
| 116 | + { type: 'text', content: 'Destructive Text', color: 'text-destructive' }, |
| 117 | + { type: 'text', content: 'Muted Text', color: 'text-muted-foreground' } |
| 118 | + ] |
| 119 | + }} |
| 120 | + title="Text with Colors" |
| 121 | +/> |
| 122 | + |
| 123 | +### Text Alignment |
| 124 | + |
| 125 | +<ComponentDemo |
| 126 | + schema={{ |
| 127 | + type: 'stack', |
| 128 | + gap: 4, |
| 129 | + children: [ |
| 130 | + { type: 'text', content: 'Left aligned text', align: 'left' }, |
| 131 | + { type: 'text', content: 'Center aligned text', align: 'center' }, |
| 132 | + { type: 'text', content: 'Right aligned text', align: 'right' } |
| 133 | + ] |
| 134 | + }} |
| 135 | + title="Text Alignment" |
| 136 | +/> |
0 commit comments