Icon
The icon component uses Lucide Vue under the hood for string icon names. Check out the full icon list from Lucide.
Overview
ct-icon is a smart icon component that automatically detects and renders the correct element based on the name prop:
| Input type | Example | Renders |
|---|---|---|
| Empty / undefined | β | Default fallback (CircleHelp) |
| Vue Component | :name="MyIcon" | <component :is> |
| Emoji | name="π" | <span> with font-size |
| Image URL or path | name="/logo.svg" | <NuxtImg> with lazy loading |
| File extension / name | name="js", name="vue" | Matched icon via useFileIcon |
| Lucide icon string | name="lucide:box" | Resolved Lucide component |
| Unresolved string | name="unknown" | Default fallback (CircleHelp) |
Usage
Lucide Icons
Pass a Lucide icon name using the lucide: prefix or just the kebab-case name directly.
Lucide
File-Type Icons
Pass a file extension or known filename to automatically resolve a technology icon (e.g. TypeScript, Vue, Python).
File Types
Emojis
Pass an emoji string directly. Use the :size prop to control the font size.
Emojis
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.
URL
Default Fallback
When no name is provided or the name cannot be resolved, a default CircleHelp icon is rendered.
Fallback
Props
CircleHelp when empty or unresolved. 16width/height for images and size prop for Lucide icons. Resolution Order
The component resolves the name prop in the following priority:
- Empty β renders the default
CircleHelpicon. - Vue Component β renders the component directly via
<component :is>. - Emoji β renders inside a
<span>with matching font size. - Image β renders via
<NuxtImg>withlazyloading, explicitwidthandheight. - File-type match β resolves via
useFileIcon(supports extensions likejs,vue,ts,py, and known filenames likepackage.json). - Lucide icon β converts the name to PascalCase and looks up the Lucide icon registry.
- Unresolved β falls back to the default
CircleHelpicon.