UTA DevHub

Icon Management

Comprehensive guide for managing UI icons in React Native applications with unified component system and type safety

Icon Management Guide

Overview

This guide provides a comprehensive system for managing UI icons (navigation, actions, status) in React Native applications. It covers vector icon libraries, custom designer SVGs, and provides a unified component system with complete type safety.

Important Scope: This system handles UI icons only. For brand assets (logos, illustrations), see the Brand Assets Overview.

Quick Decision Framework

When to Use Each Icon Type

Icon TypeUse CaseExamplesBenefits
Vector IconsStandard UI patternsHome, Search, Menu, SettingsSmall bundle, consistent style
Custom SVGsBrand-specific UICustom navigation, unique actionsPerfect brand alignment
Icon FontsLegacy or specializedSymbol fonts, custom icon setsSingle file, efficient
Project TypePrimary ChoiceSecondaryBundle Priority
MVP@expo/vector-iconsCustom SVGs for brandSpeed
Corporatereact-native-vector-iconsCustom SVGsConsistency
ConsumerCustom SVGs + VectorIcon fontsBrand differentiation
White LabelConfigurable registryAll typesFlexibility

Architecture Overview

Core Components

// Unified Icon System Architecture
<Icon name="search" size={24} color="primary" />     // Vector icons
<Icon name="custom-action" size={20} />              // Custom SVGs  
<Icon name="brand-symbol" size={16} />               // Icon fonts

Directory Structure

ui/foundation/Icon/
├── Icon.tsx              # Unified Icon component
├── registry.ts           # Co-located icon registry
├── types.ts              # TypeScript definitions
└── index.ts              # Clean exports

ui/foundation/icons/custom/    # Flat structure for custom SVGs
├── ArrowLeftIcon.tsx
├── MenuIcon.tsx
├── SearchIcon.tsx
└── index.ts

assets/icons/              # Processing workspace
├── custom-exports/        # Designer SVG exports
└── optimized/             # Processed SVGs

Implementation Guides

📚 Detailed Documentation

Choose the guide that matches your implementation needs:

Vector Icons Guide

  • @expo/vector-icons setup and usage
  • react-native-vector-icons configuration
  • Popular icon libraries (FontAwesome, Ionicons, MaterialIcons)
  • Platform-specific considerations

Custom Icons Guide

  • Designer SVG workflow (Figma → React Native)
  • Flat folder structure implementation
  • SVGR automation and optimization
  • Icon font creation

Implementation Patterns

  • Co-located icon registry pattern
  • Unified Icon component
  • Type safety and validation
  • Testing strategies

Performance Optimization

  • Bundle size optimization
  • Runtime performance
  • Memory management
  • Cross-platform considerations

Quick Start

1. Choose Your Primary Icon Source

// Option A: Start with @expo/vector-icons (Recommended for Expo)
import Ionicons from '@expo/vector-icons/Ionicons';
<Ionicons name="home" size={24} color="black" />
 
// Option B: Start with react-native-vector-icons
import Icon from 'react-native-vector-icons/MaterialIcons';
<Icon name="home" size={24} color="black" />
 
// Option C: Start with custom SVGs
<Icon name="custom-home" size={24} color="primary" />
// ui/foundation/Icon/Icon.tsx
interface IconProps {
  name: string;
  size?: number;
  color?: string;
}
 
export const Icon: React.FC<IconProps> = ({ name, size = 24, color = "black" }) => {
  // Implementation in detailed guides
};

3. Configure Your Registry

// ui/foundation/Icon/registry.ts
export const IconRegistry = {
  vector: {
    // Vector icon mappings
  },
  custom: {
    // Custom SVG mappings
  },
  fonts: {
    // Icon font mappings
  },
};

Why Use a Registry? The registry pattern provides type safety, consistency, and maintainability that significantly outweighs the initial setup cost. See Why Use an Icon Registry Pattern? for detailed pros/cons analysis.

Best Practices

Design Principles

  • (Do ✅) Use vector icons for standard UI patterns
  • (Do ✅) Keep icon registry co-located with Icon component
  • (Do ✅) Implement flat folder structure for custom icons
  • (Do ✅) Ensure complete type safety
  • (Don't ❌) Mix UI icons with brand assets
  • (Don't ❌) Create deep nested icon directories

Performance Guidelines

  • (Do ✅) Tree shake vector icon libraries
  • (Do ✅) Optimize custom SVGs before conversion
  • (Do ✅) Use appropriate icon sizes (16, 20, 24, 32px)
  • (Consider 🤔) Icon font generation for large custom sets

Migration Strategy

From Mixed Icon Approach

  1. Audit Current Icons: Categorize UI icons vs brand assets
  2. Choose Primary Vector Library: @expo/vector-icons or react-native-vector-icons
  3. Implement Unified Component: Gradual migration with backwards compatibility
  4. Move Custom Icons: Flat structure with SVGR automation
  5. Update Registry: Co-located with complete type definitions

From No Icon System

  1. Start with Vector Icons: Quick wins with standard patterns
  2. Add Custom SVGs: For brand-specific UI needs
  3. Implement Registry: Centralized management
  4. Add Type Safety: Complete TypeScript integration

Next Steps

  1. Review Project Type: Choose recommended approach from decision framework
  2. Select Guide: Pick the most relevant implementation guide
  3. Set Up Infrastructure: Follow step-by-step setup instructions
  4. Implement Gradually: Start with most common icons