This document tracks the implementation of the Typography System standardization for Predictify frontend. The goal is to eliminate arbitrary font sizes, establish a clear hierarchy, and ensure responsive typography across all breakpoints.
Updated tailwind.config.ts with:
- 6 Heading levels (H1-H6) with defined sizes, weights, and letter spacing
- 3 Body text sizes (lg, md, sm) with proper line heights
- Caption & Label styles (12px, 14px) for metadata
- Numeric/Stat text (lg, md, sm) for emphasized numbers
- Monospace variants for code content
- Font family improvements from Arial to system-ui
Key sizes defined:
- H1: 40px (bold, -0.02em letter spacing)
- H2: 32px (bold, -0.01em)
- H3: 24px (bold, -0.01em)
- H4: 20px (semibold)
- H5: 18px (semibold)
- H6: 16px (semibold)
- Body-lg: 18px
- Body-md: 16px (default)
- Body-sm: 14px
- Caption: 12px (medium weight)
- Stat-lg: 32px (bold)
- Stat-md: 24px (bold)
- Stat-sm: 18px (bold)
Updated both app/globals.css and styles/globals.css with:
-
Responsive typography utilities
.text-h1-responsive- scales from 24px (mobile) → 32px (tablet) → 40px (desktop).text-h2-responsive- scales from 18px → 24px → 32px.text-h3-responsive- scales from 14px → 18px → 24px.text-h4-responsive- scales from 12px → 16px → 20px
-
Text wrapping utilities
.text-balance- natural text wrapping for headings.truncate-lines-2- truncate after 2 lines with ellipsis.truncate-lines-3- truncate after 3 lines with ellipsis.text-ellipsis-overflow- single-line truncation
-
Base semantic HTML styling (h1-h6, p, small)
Created components/typography-example.tsx demonstrating:
- All heading levels (H1-H6) with sizes and weights
- Body text variants (large, medium, small)
- Labels and captions
- Numeric/stat text
- Text wrapping behaviors with examples
- Market card example
- Event details example with responsive layout
- Color and emphasis combinations
Updated these components to use standard typography:
components/cards/step-card.tsx
- Replaced
text-[24.83px]→text-h3 - Replaced
text-[19.86px]→text-body-lg - Replaced
text-[17.38px]→text-h5 - Updated icon/check sizes to standard units
components/features-card.tsx
- Replaced
text-[25px]→text-h4 - Replaced
text-[20px]→text-body-lg
components/sections/hero.tsx
- New: Used
text-h1-responsivefor main hero headings - Updated market card titles to
text-h4,text-h6 - Replaced
text-lgwithtext-body-lg - Replaced
text-smwithtext-body-smortext-label - Updated notifications to use proper typography scale
app/(marketing)/_sections/how-it-works.tsx
- Replaced
text-[44.69px]→text-h2-responsive - Replaced
text-[24.83px]→text-h3-responsive - Replaced
text-[17.38px]→text-h5
Created TYPOGRAPHY.md with:
- Quick reference table for all typography classes
- Detailed hierarchy explanations
- Code examples for each level
- Responsive typography examples
- Text wrapping/truncation patterns
- Market card example implementation
- Event details page example
- Table examples
- Best practices (DO's and DON'Ts)
- Migration guide (old → new patterns)
- Testing checklist
// Main page title - responsive
<h1 className="text-h1-responsive">Page Title</h1>
// Desktop-only heading
<h2 className="text-h2">Section Heading</h2>
// Card title
<h3 className="text-h3">Market Title</h3>// Introduction paragraph
<p className="text-body-lg">Large body text</p>
// Standard paragraph
<p className="text-body-md">Default paragraph</p>
// Secondary information
<p className="text-body-sm text-muted-foreground">Secondary text</p>// Prevent layout breaking - method 1: text balance
<h3 className="text-h3 text-balance">
Question that might wrap awkwardly
</h3>
// Method 2: truncate to 2 lines
<p className="text-body-md truncate-lines-2">
Very long question text...
</p>// Large dashboard number
<div className="text-stat-lg font-bold">$45,230</div>
// Card metric
<div className="text-stat-md font-bold">234</div>
// Small badge number
<div className="text-stat-sm font-bold">5</div>| Breakpoint | Width | Usage |
|---|---|---|
| Mobile | < 640px | Base/default sizes |
| Tablet (sm) | 640px+ | Medium sizes |
| Tablet (md) | 768px+ | Larger sizes |
| Desktop (lg) | 1024px+ | Full H1-H6 sizes |
When updating other components:
-
Replace arbitrary pixel sizes with semantic classes
- Don't use:
text-[24.83px],leading-[40.89px] - Do use:
text-h3(includes size and weight)
- Don't use:
-
Use responsive classes for mobile-first design
- Don't hardcode sizes for mobile/desktop
- Do use:
text-h1-responsivefor auto-scaling
-
Choose the right semantic level
- Card titles:
text-h4 - Subsection headings:
text-h3-responsive - Large numbers:
text-stat-lg - Help text:
text-caption
- Card titles:
-
Handle long content
- Questions: use
truncate-lines-2ortext-balance - Table cells: use
truncate-lines-2 - Breadcrumbs: use
text-ellipsis-overflow
- Questions: use
- H1-H6 headings display correctly on mobile (<640px)
- Responsive classes scale properly on tablet (640px-1024px)
- Long questions don't break layout (truncate-lines-2/3 working)
- Body text is readable on small screens
- Numbers stand out with stat-* classes
- Dark mode contrast passes WCAG AA
- Font stacks fallback correctly (system-ui → sans-serif)
- Captions and labels are visually distinct
- Text balance works for multi-line headings
- Mobile viewport (375px) displays correctly
tailwind.config.ts- Added typography scaleapp/globals.css- Added responsive utilitiesstyles/globals.css- Added responsive utilitiescomponents/cards/step-card.tsx- Standardized typographycomponents/features-card.tsx- Standardized typographycomponents/sections/hero.tsx- Standardized typographyapp/(marketing)/_sections/how-it-works.tsx- Standardized typography
TYPOGRAPHY.md- Complete typography documentationcomponents/typography-example.tsx- Interactive examples component
- Update remaining components in dashboard and event pages to use standard typography
- Test on real devices (iOS, Android) for mobile readability
- Verify contrast ratios for accessibility compliance
- Update component library documentation if applicable
- Create Storybook stories for typography components (optional)
- Components already updated are production-ready
- Other components should migrate one page at a time
- Test thoroughly on mobile before deployment
- Use
text-balanceandtruncate-lines-*on all long text - Reference
TYPOGRAPHY.mdfor implementation details
- See
TYPOGRAPHY.mdfor detailed usage examples - View
components/typography-example.tsxfor interactive demo - Reference updated components for implementation patterns