---
title: "Icon"
canonical_url: "https://nnsvn.me/products/nuxt-starter-kit/components/docs/icon"
---

> Index of every page on this site: [llms.txt](https://nnsvn.me/llms.txt)

<ct-alert target="_blank" to="https://lucide.dev/guide/packages/@lucide/vue">

The icon component uses **Lucide Vue** under the hood for string icon names. Check out the full icon list from Lucide.

</ct-alert>

## Overview

`ct-icon` is a smart icon component that automatically detects and renders the correct element based on the `name` prop:

<table>
<thead>
  <tr>
    <th>
      Input type
    </th>
    
    <th>
      Example
    </th>
    
    <th>
      Renders
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Empty / undefined
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Default fallback (<code>
        CircleHelp
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      Vue Component
    </td>
    
    <td>
      <code>
        :name="MyIcon"
      </code>
    </td>
    
    <td>
      <code>
        <component :is>
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Emoji
    </td>
    
    <td>
      <code>
        name="🚀"
      </code>
    </td>
    
    <td>
      <code>
        <span>
      </code>
      
       with font-size
    </td>
  </tr>
  
  <tr>
    <td>
      Image URL or path
    </td>
    
    <td>
      <code>
        name="/logo.svg"
      </code>
    </td>
    
    <td>
      <code>
        <NuxtImg>
      </code>
      
       with lazy loading
    </td>
  </tr>
  
  <tr>
    <td>
      File extension / name
    </td>
    
    <td>
      <code>
        name="js"
      </code>
      
      , <code>
        name="vue"
      </code>
    </td>
    
    <td>
      Matched icon via <code>
        useFileIcon
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Lucide icon string
    </td>
    
    <td>
      <code>
        name="lucide:box"
      </code>
    </td>
    
    <td>
      Resolved Lucide component
    </td>
  </tr>
  
  <tr>
    <td>
      Unresolved string
    </td>
    
    <td>
      <code>
        name="unknown"
      </code>
    </td>
    
    <td>
      Default fallback (<code>
        CircleHelp
      </code>
      
      )
    </td>
  </tr>
</tbody>
</table>

## Usage

### Lucide Icons

Pass a Lucide icon name using the `lucide:` prefix or just the kebab-case name directly.

<ct-stack>
<div className="p-4">

**Lucide**

<div className="space-x-2">
<ct-icon name="lucide:box">



</ct-icon>

<ct-icon name="lucide:star">



</ct-icon>

<ct-icon name="lucide:heart">



</ct-icon>

<ct-icon name="arrow-right">



</ct-icon>
</div>
</div>

```mdc
:ct-icon{name="lucide:box"}
:ct-icon{name="lucide:star"}
:ct-icon{name="lucide:heart"}
:ct-icon{name="arrow-right"}
```

</ct-stack>

### File-Type Icons

Pass a file extension or known filename to automatically resolve a technology icon (e.g. TypeScript, Vue, Python).

<ct-stack>
<div className="p-4">

**File Types**

<div className="space-x-2">
<ct-icon name="js">



</ct-icon>

<ct-icon name="vue">



</ct-icon>

<ct-icon name="ts">



</ct-icon>

<ct-icon name="py">



</ct-icon>

<ct-icon name="css">



</ct-icon>
</div>
</div>

```mdc
:ct-icon{name="js"}
:ct-icon{name="vue"}
:ct-icon{name="ts"}
:ct-icon{name="py"}
:ct-icon{name="css"}
```

</ct-stack>

### Emojis

Pass an emoji string directly. Use the `:size` prop to control the font size.

<ct-stack>
<div className="p-4">

**Emojis**

<div className="space-x-2">
<ct-icon name="😍">



</ct-icon>

<ct-icon name="🚀">



</ct-icon>

<ct-icon name="🎉" :size="30">



</ct-icon>
</div>
</div>

```mdc
:ct-icon{name="😍"}
:ct-icon{name="🚀"}
:ct-icon{name="🎉" :size="30"}
```

</ct-stack>

### Images (URL or Path)

Pass an image URL or local path. The component renders a `<NuxtImg>` with lazy loading and explicit `width`/`height` for better performance.

<ct-stack>
<div className="p-4">

**URL**

<div className="space-x-2">
<ct-icon name="/favicon.svg">



</ct-icon>

<ct-icon name="https://vueuse.org/favicon.svg" :size="40">



</ct-icon>
</div>
</div>

```mdc
:ct-icon{name="/favicon.svg"}
:ct-icon{name="https://vueuse.org/favicon.svg" :size="40"}
```

</ct-stack>

### Default Fallback

When no `name` is provided or the name cannot be resolved, a default `CircleHelp` icon is rendered.

<ct-stack>
<div className="p-4">

**Fallback**

<div className="space-x-2">
<ct-icon>



</ct-icon>

<ct-icon name="unknown-icon-name">



</ct-icon>
</div>
</div>

```mdc
:ct-icon{}
:ct-icon{name="unknown-icon-name"}
```

</ct-stack>

## Props

<ct-field-group>
<ct-field name="name" type="string | Component">

Icon name, emoji, image URL, file extension, or a Vue component. Falls back to `CircleHelp` when empty or unresolved.

</ct-field>

<ct-field name="size" type="number" default-value="16">

Icon size in pixels. Controls both `width`/`height` for images and `size` prop for Lucide icons.

</ct-field>

<ct-field name="class" type="string">

Additional CSS classes to apply to the rendered element.

</ct-field>
</ct-field-group>

## Resolution Order

The component resolves the `name` prop in the following priority:

1. **Empty** → renders the default `CircleHelp` icon.
2. **Vue Component** → renders the component directly via `<component :is>`.
3. **Emoji** → renders inside a `<span>` with matching font size.
4. **Image** → renders via `<NuxtImg>` with `lazy` loading, explicit `width` and `height`.
5. **File-type match** → resolves via `useFileIcon` (supports extensions like `js`, `vue`, `ts`, `py`, and known filenames like `package.json`).
6. **Lucide icon** → converts the name to PascalCase and looks up the Lucide icon registry.
7. **Unresolved** → falls back to the default `CircleHelp` icon.

## Sitemap

See the full [sitemap](https://nnsvn.me/sitemap.md) for all pages.
