Appearance
Typography System
This guide explains the typography system in LamaPress, including how to use typography classes and customize the system.
Table of Contents
- Overview
- Typography Classes
- Using Typography Classes
- Responsive Typography
- Customizing Typography
- Best Practices
- Related Documentation
Overview
LamaPress uses a custom typography system that generates responsive typography classes from tailwind/config/typography.js. Classes follow the pattern ll-{category}-{size} and automatically scale between mobile and desktop sizes.
Typography Classes
Class Format
Typography classes follow this pattern:
ll-{category}-{size}Examples:
ll-display-2xl- Large display textll-heading-1- Level 1 headingll-body-rg- Regular body text
Available Categories
Display (
ll-display-{size})- Large, attention-grabbing text
- Used for hero headlines, large callouts
Heading (
ll-heading-{level})- Semantic headings (h1-h6 equivalent)
- Used for section headings, page titles
Body (
ll-body-{size})- Body text and paragraphs
- Used for content, descriptions
Available Sizes
Display:
ll-display-2xl- 40px → 96pxll-display-xl- 32px → 72pxll-display-md- 24px → 48pxll-display-xs- 20px → 24px
Heading:
ll-heading-1- 32px → 48pxll-heading-2- 28px → 40pxll-heading-3- 24px → 32pxll-heading-4- 20px → 24pxll-heading-5- 18px → 20pxll-heading-6- 16px → 18px
Body:
ll-body-xl- 24px → 32pxll-body-lg- 18px → 20pxll-body-rg- 14px → 16pxll-body-sm- 12px → 14px
Using Typography Classes
Display Text
Use display classes for large, prominent text:
html
<h1 class="ll-display-2xl">Welcome to Our Site</h1>
<p class="ll-display-xl">Subheading text</p>Headings
Use heading classes for semantic headings:
html
<h1 class="ll-heading-1">Page Title</h1>
<h2 class="ll-heading-2">Section Title</h2>
<h3 class="ll-heading-3">Subsection Title</h3>Body Text
Use body classes for content text:
html
<p class="ll-body-lg">Large body text for important content</p>
<p class="ll-body-rg">Regular body text for standard content</p>
<p class="ll-body-sm">Small body text for captions, metadata</p>Responsive Typography
Typography classes automatically scale between mobile (800px) and desktop (1440px) breakpoints using CSS clamp():
css
/* ll-heading-1 generates: */
font-size: clamp(2rem, calc(2rem + 1vw), 3rem);This ensures:
- Minimum size on mobile (first value)
- Maximum size on desktop (last value)
- Smooth scaling in between
Customizing Typography
Adding New Sizes
Edit tailwind/config/typography.js:
javascript
export const typography = {
display: {
global: {
fontFamily: 'sans',
fontWeight: 300,
},
'2xl': {
fontSize: [40, 96],
},
// Add new size
'3xl': {
fontSize: [48, 120],
},
},
// ...
}Then use: ll-display-3xl
Modifying Existing Sizes
Edit the size values in tailwind/config/typography.js:
javascript
heading: {
'1': {
fontSize: [32, 48], // [mobile, desktop] in pixels
lineHeight: 1.2, // Optional line height
},
}Note: Changes require rebuilding Tailwind CSS (npm run build).
Best Practices
1. Use Semantic Classes
Use appropriate category for content:
- Display for hero/attention text
- Heading for section titles
- Body for content text
2. Maintain Hierarchy
Follow heading hierarchy:
- Use
ll-heading-1for main page title - Use
ll-heading-2for major sections - Use
ll-heading-3for subsections - Don't skip levels
3. Test Responsive
Always test typography at different viewport sizes:
- Mobile (400px)
- Tablet (800px)
- Desktop (1440px+)
Related Documentation
- Styling Overview - Styling approach
- Tailwind Configuration - Tailwind setup
- Responsive Design - Responsive patterns
Next Steps:
- Review Color System for text colors
- Check Responsive Design for responsive patterns
- See existing components for typography usage examples