Overview
Latch uses Lucide React icons throughout the application. This guide explains the pattern for adding and configuring icons in your components and config files.Icon Pattern: Config files store icon names as strings, then components import specific icons from
lucide-react and map them using an iconMap object.How It Works
- 1. Config File
- 2. Component
- Bundle Impact
In your config files, icons are defined as PascalCase string names:
config/example.ts
Use exact PascalCase names from lucide.dev/icons
Adding New Icons
Find the Icon
Browse lucide.dev/icons to find the icon you need. Note the exact name (e.g.,
Zap, Shield, Heart).Icon Naming Conventions
All icons use PascalCase in both config and imports for consistency:Always use PascalCase: Icon names in config files must match the exact PascalCase names from lucide.dev/icons.
Real-World Examples
- Game Features
- Partner Benefits
- Partner Requirements
8 icons imported - Only bundles what’s actually used across the component
Common Patterns
- Icon Sizes
- Dynamic Colors
- Icon Containers
- Conditional Rendering
Standard sizes used throughout Latch:
| Size | Tailwind Class | Usage |
|---|---|---|
| Small | w-4 h-4 | Navbar, inline text, breadcrumbs |
| Medium | w-5 h-5 | Buttons, cards, list items |
| Large | w-6 h-6 | Features, benefits, stats |
| XL | w-8 h-8 | Hero sections, headers, highlights |
| 2XL | w-10 h-10 | Large cards, testimonials |
| 3XL | w-12 h-12 | Icon containers, showcases |
Best Practices
Use Direct Imports
Use Direct Imports
Good:Bad:
Keep iconMap One-Liner
Keep iconMap One-Liner
Good:Bad:
Match Config Icon Names
Match Config Icon Names
Ensure config strings match the exact PascalCase Lucide icon names:
Use Type Safety
Use Type Safety
Troubleshooting
Icon not displaying?
Icon not displaying?
Check:
- Icon name in config uses exact PascalCase from lucide.dev
- Icon is imported in component
- Icon is added to iconMap with same name
- Icon exists on lucide.dev/icons
TypeScript errors?
TypeScript errors?
Use
as keyof typeof iconMap for type safety:Icon names with spaces or dashes?
Icon names with spaces or dashes?
Lucide icons use PascalCase with no spaces:
- Wrong: “message-circle”
- Wrong: “message circle”
- Correct: “MessageCircle”
Icon not found in Lucide?
Icon not found in Lucide?
- Search lucide.dev/icons
- Consider similar alternatives
- Use a custom SVG if needed (add to
/public/icons/)
Where Icons Are Used
Branding
Navbar icons, social links, logo
Home Page
Hero icons, features, stats, benefits
Game Servers
Game features, common includes, specs
Partners
Benefits, requirements, platform icons
Knowledge Base
Article categories, content blocks
Hardware
Processor features, specifications
Quick Reference
| Location | Icon Pattern | Example |
|---|---|---|
| Config | PascalCase string | "Shield" |
| Import | Named import | import { Shield } from "lucide-react" |
| iconMap | Object shorthand | const iconMap = { Shield } |
| Usage | Dynamic lookup | iconMap[item.icon as keyof typeof iconMap] |

