@vivekcsein-logo
  • Home
  • About
  • Development

    • Web Development
    • Performance & Optimization
    • Backend & APIs
    • Authentication & Security

    Specialized

    • SEO & Ad Monetization
    • AR Experiences
    • Animation
    • Figma to Code
  • Articles
  • Projects
  • Marketplace
  • Contact
@vivekcsein-logo

A portfolio full stack developer with a passion for building scalable and high-performance web applications.

Explore

  • Home
  • About

Services

  • Web Development
  • Backend & APIs
  • Performance Optimization
  • Security & Authentication

Connect

  • Contact
  • Privacy
  • Terms
  • Home
  • About
  • Web Development
  • Backend & APIs
  • Performance Optimization
  • Security & Authentication
  • Contact
  • Privacy
  • Terms

© @vivekcsein. All rights reserved.

  • Home
  • All Articles47
  • Featured
  • Recently Added
  • Most Read
  • Bookmarks
Topics
  • Interview3
  • 3d4
  • Ai Prompts2
  • Business3
  • Deployment1
  • Dev2
  • Frontend5
  • Getting Started2
  • Security2
  • Seo2
  • Workflow10
    • Stage 1 — Project Initialization
    • Stage 2 — Professional Development Environment
    • Stage 3 — Enterprise Architecture
    • Stage 4 — Design System
    • Stage 5 — Design System Implementation
    • Stage 6 — Reusable UI Components
    • Stage 7 — Server-Only Icon System
    • Stage 8 — Project Environment Setup
    • Stage 9 — shadcn/ui Integration
    • Stage 10 — API Layer
  • Backend1
  • Deployment1
  • Security1
  • Javascript1
  • Client Advisory5
  • Engineering2
Collections
  • Docs
  • Tutorials
  • Resources
  • Articles
“A better developer every single day.”
— Vivek
  1. Docs
  2. Workflow
  3. Stage 7 — Server-Only Icon System
Workflow

Stage 7 — Server-Only Icon System

A centralized, server-rendered LucideIcon wrapper that gives every component one consistent icon API, with usage rules and the bundle-size trade-offs.

Updated Oct 2, 20263 min read
On this page

On this page

  • Goal
  • Why Use a Custom Icon Component?
  • Server-Only Rendering
  • Component Location
  • Usage
  • How It Works
  • Naming Convention
  • Project Convention
  • Best Practices
  • Performance Notes
  • Expected Outcome

Goal#

Create a centralized, server-rendered icon system that minimizes client-side JavaScript while providing a single, consistent API for rendering icons throughout the application.

Instead of importing individual icons directly from lucide-react across multiple components, the project uses a custom wrapper component named LucideIcon.


Why Use a Custom Icon Component?#

Using a single wrapper provides several advantages:

  • Centralized icon rendering
  • Consistent API across the project
  • Easier refactoring and maintenance
  • Supports dynamic icon rendering
  • Keeps component code clean
  • Eliminates repetitive icon imports

Server-Only Rendering#

LucideIcon is designed to be used as a Server Component.

Because it does not include "use client" and does not rely on browser APIs, it renders entirely on the server.

Benefits include:

  • No client-side hydration
  • Reduced JavaScript sent to the browser
  • Faster initial page load
  • Better SEO
  • Improved performance

This makes the icon system ideal for layouts, navigation, dashboards, tables, forms, and other server-rendered UI.


Component Location#

Recommended project structure:

text
components/
└── ui/
    └── images/
        └── LucideIcon.tsx

Usage#

Render any supported Lucide icon by passing its component name.

tsx
<LucideIcon iconName="Home" />

<LucideIcon iconName="User" />

<LucideIcon iconName="Settings" />

<LucideIcon iconName="ChevronRight" />

The component accepts all standard SVG properties.

Example:

tsx
<LucideIcon iconName="Home" className="size-5" strokeWidth={2} />

How It Works#

Internally, the component:

  1. Imports the icons registry from lucide-react.
  2. Receives the icon name as a string.
  3. Looks up the matching icon component.
  4. Renders the icon if it exists.
  5. Returns null when an invalid icon name is supplied.

This enables dynamic rendering without importing icons individually throughout the application.


Naming Convention#

Always use the official Lucide component name.

Examples:

text
Home
User
Settings
Search
Calendar
Bell
ChevronRight
ArrowUpRight
Folder
FileText
CircleHelp

Avoid using custom aliases or modified names.


Project Convention#

Instead of:

tsx
import { Home, User, Search } from "lucide-react";

<Home />
<User />
<Search />

Use:

tsx
<LucideIcon iconName="Home" />
<LucideIcon iconName="User" />
<LucideIcon iconName="Search" />

This keeps every component consistent and avoids repetitive imports.


Best Practices#

✅ Use LucideIcon throughout the application.

✅ Pass the icon name as a string.

✅ Forward SVG props such as:

  • className
  • width
  • height
  • strokeWidth
  • color

✅ Keep icon rendering inside Server Components whenever possible.


Performance Notes#

  • Icons are rendered on the server, eliminating hydration work for the icon component itself.
  • A single wrapper simplifies maintenance and provides a uniform interface across the codebase.
  • Because lucide-react exports React components, your application bundle still contains the icon components that are actually referenced by your build. The wrapper improves consistency and server rendering, but it does not automatically guarantee that every unused icon is excluded solely because the icon name is provided as a string. If minimizing icon bundle size becomes critical in client components, consider using static imports for those cases.

Expected Outcome#

After completing this stage, the project will have:

  • A centralized icon system
  • A consistent icon API
  • Server-rendered icons by default
  • Clean, maintainable component code
  • Enterprise-ready icon architecture
PreviousStage 6 — Reusable UI ComponentsNext Stage 8 — Project Environment Setup

Keep reading

  • Workflow

    Stage 4 — Design System

    The design-system contract: semantic tokens, light/dark/system themes, shadcn-compatible variables and how every token maps to a Tailwind utility.

    3 min read·Oct 2, 2026
  • Workflow

    Stage 5 — Design System Implementation

    Implement the design system: CSS variables, next-themes, typography, spacing, radius and shadow scales, cn(), CVA variants and the first reusable UI components.

    3 min read·Oct 2, 2026
  • Workflow

    Stage 6 — Reusable UI Components

    The rulebook for reusing, extending or creating UI components: Button, InputFactory, Link, IconSVG, LucideIcon and shadcn, with a decision tree.

    4 min read·Oct 2, 2026

On this page

  • Goal
  • Why Use a Custom Icon Component?
  • Server-Only Rendering
  • Component Location
  • Usage
  • How It Works
  • Naming Convention
  • Project Convention
  • Best Practices
  • Performance Notes
  • Expected Outcome