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
export const exampleConfig = {
  features: [
    {
      title: "Fast Performance",
      icon: "Zap", // String name matching Lucide icon
      color: "blue",
    },
    {
      title: "Secure",
      icon: "Shield",
      color: "green",
    },
  ],
};
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:
icon: "Heart", // Exact name from lucide.dev
3

Import in Component

Import the icon in your component:
import { Zap, Shield, Heart } from "lucide-react";
4

Add to iconMap

Add it to the iconMap object:
const iconMap = { Zap, Shield, Heart };

Icon Naming Conventions

All icons use PascalCase in both config and imports for consistency:
// Config
icon: "Shield"

// Component
import { Shield } from "lucide-react";
const iconMap = { Shield };
Always use PascalCase: Icon names in config files must match the exact PascalCase names from lucide.dev/icons.

Real-World Examples

export const gamesCommonConfig = {
  features: [
    { title: "DDoS Protection", icon: "Shield", color: "blue" },
    { title: "Instant Setup", icon: "Zap", color: "purple" },
    { title: "NVMe Storage", icon: "HardDrive", color: "green" },
    { title: "24/7 Support", icon: "LifeBuoy", color: "yellow" },
  ],
};
8 icons imported - Only bundles what’s actually used across the component

Common Patterns

Standard sizes used throughout Latch:
SizeTailwind ClassUsage
Smallw-4 h-4Navbar, inline text, breadcrumbs
Mediumw-5 h-5Buttons, cards, list items
Largew-6 h-6Features, benefits, stats
XLw-8 h-8Hero sections, headers, highlights
2XLw-10 h-10Large cards, testimonials
3XLw-12 h-12Icon containers, showcases
// Navbar icon
<Icon className="w-4 h-4" />

// Feature icon
<Icon className="w-6 h-6" />

// Hero icon
<Icon className="w-8 h-8" />

Best Practices

Good:
import { Shield, Zap } from "lucide-react";
Bad:
import * as LucideIcons from "lucide-react"; // Bloats bundle
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:
const iconMap = { Shield, Zap, HardDrive };
Bad:
const iconMap = {
  Shield,
  Zap,
  HardDrive,
}; // Unnecessary verbosity
Ensure config strings match the exact PascalCase Lucide icon names:
// Config
icon: "MessageCircle" // Exact PascalCase match

// Component
import { MessageCircle } from "lucide-react";
const iconMap = { MessageCircle };
const Icon = iconMap[feature.icon as keyof typeof iconMap];
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:
// Config: icon: "Mail"
// Component: import { Mail } from "lucide-react";
// iconMap: { Mail }
Use as keyof typeof iconMap for type safety:
const Icon = iconMap[item.icon as keyof typeof iconMap];
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

LocationIcon PatternExample
ConfigPascalCase string"Shield"
ImportNamed importimport { Shield } from "lucide-react"
iconMapObject shorthandconst iconMap = { Shield }
UsageDynamic lookupiconMap[item.icon as keyof typeof iconMap]
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