Skip to main content

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

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

1

Find the Icon

Browse lucide.dev/icons to find the icon you need. Note the exact name (e.g., Zap, Shield, Heart).
2

Add to Config

Add the icon name as a string in your config file:
3

Import in Component

Import the icon in your component:
4

Add to iconMap

Add it to the iconMap object:

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

8 icons imported - Only bundles what’s actually used across the component

Common Patterns

Standard sizes used throughout Latch:

Best Practices

Good:
Bad:
You can use import * as LucideIcons, but it prevents tree-shaking and bundles ALL 1,000+ icons (~300KB extra) even if you only use 5. Direct imports ensure only used icons are bundled.
Good:
Bad:
Ensure config strings match the exact PascalCase Lucide icon names:
This prevents runtime errors if an icon is missing from the map.

Troubleshooting

Check:
  1. Icon name in config uses exact PascalCase from lucide.dev
  2. Icon is imported in component
  3. Icon is added to iconMap with same name
  4. Icon exists on lucide.dev/icons
Example:
Use as keyof typeof iconMap for type safety:
Lucide icons use PascalCase with no spaces:
  • Wrong: “message-circle”
  • Wrong: “message circle”
  • Correct: “MessageCircle”
  1. Search lucide.dev/icons
  2. Consider similar alternatives
  3. 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

When adding multiple icons, do it all at once:
  1. Update config with all icon names
  2. Import all icons in one line
  3. Add all to iconMap in one line