Custom Icons Guide
Complete workflow for implementing custom designer SVGs with flat folder structure, SVGR automation, and icon font creation
Custom Icons Implementation Guide
Overview
Custom icons enable perfect brand alignment while maintaining systematic UI iconography. This guide covers the complete workflow from designer export to React Native implementation using a flat folder structure with SVGR automation.
Scope: This covers UI icons only. For brand assets (logos, complex illustrations), see the Brand Assets Overview.
When to Use Custom Icons
✅ Use Custom Icons For:
- Brand-specific UI patterns - Navigation styles unique to your brand
- Custom action icons - Actions not available in standard libraries
- Consistent design language - Icons that match your exact design system
- Specialized functionality - Domain-specific actions or states
🤔 Consider Vector Icons Instead:
- Standard UI patterns - Home, search, menu, settings
- MVP development - Speed over perfect brand alignment
- Small teams - Limited design resources
Flat Folder Structure Architecture
Core Principle: Simplicity
Why Flat Structure?
- (Do ✅) Easy discovery and navigation
- (Do ✅) Simplified imports and maintenance
- (Do ✅) No deep nesting complexity
- (Do ✅) Consistent with foundation component patterns
Designer-Developer Workflow
Phase 1: Designer Guidelines
Designer Handoff Standards
To ensure smooth implementation, establish these guidelines with your design team:
Export Requirements
| Requirement | Specification | Why Important |
|---|---|---|
| Artboard Size | 24x24px (consistent viewBox) | Scalable baseline for all screen densities |
| Stroke Width | 2px (consistent across all icons) | Visual consistency and clarity |
| Colors | Single color or currentColor | Enables theme-based color changes |
| Format | SVG (optimized export) | Vector format for perfect scaling |
| Naming | kebab-case (arrow-left, user-profile) | Consistent with component naming |
Design Checklist
- (Do ✅) Use consistent 24x24px artboard for all icons
- (Do ✅) Apply 2px stroke width throughout
- (Do ✅) Remove background fills and unnecessary elements
- (Do ✅) Use single color (#000000 or currentColor)
- (Do ✅) Optimize paths and reduce complexity
- (Don't ❌) Include multiple colors in UI icons
- (Don't ❌) Use different stroke widths within icon set
- (Don't ❌) Export with embedded text or complex effects
Phase 2: Export Process
Technical Implementation
Dependencies Setup
Configuration Files
SVGO Configuration
SVGR Configuration
Automation Scripts
Processing Pipeline
Export Generation
Package.json Scripts
Registry Integration
Custom Icon Registry
Unified Icon Component Update
Usage Examples
Basic Implementation
In Navigation Components
Theme Integration
Icon Font Generation (Advanced)
When to Consider Icon Fonts
- Large custom icon sets (50+ icons)
- Performance optimization needed
- Legacy platform support required
- Consistent baseline alignment important
Setup and Generation
Performance Optimization
Bundle Size Management
Lazy Loading Pattern
Testing Custom Icons
Component Tests
Icon Processing Tests
Troubleshooting
Common Issues
SVGR not generating proper components:
- Check SVGR configuration in
svgr.config.js - Ensure SVG files are properly optimized
- Verify template syntax is correct
Icons not displaying:
- Check if
react-native-svgis properly installed - Verify component imports are correct
- Ensure SVG viewBox is preserved
Type errors:
- Regenerate barrel exports after adding new icons
- Check TypeScript definitions in registry
- Verify icon names match file names
Platform-Specific Issues
Metro bundler errors:
- Add SVG extension to Metro configuration
- Clear Metro cache:
npx react-native start --reset-cache
Build failures:
- Ensure all SVG files are valid
- Check for unsupported SVG features
- Verify SVGR output is valid TypeScript