Files
lucide/docs/guide/advanced/aliased-names.md
Karsa 8fe835c105 feat(packages): added new @lucide/icons package (#3881)
* feat(packages): added lucide icons package skeleton

* feat(packages): added initial commit of @lucide/icons

* fix: fixed linting issues introduced in c4e5730bc4 (#3858)

* fix(packages/icons): update package, remove UMD export

* fix(packages/icons): update github actions

* docs(packages/icons): add documentation for various helpers and types

* fix(.github/ISSUE_TEMPLATE): fix linting issue (@ is a reserved character)

* fix(packages/icons): fix linting issues in configs

* feat(packages/icons): rename from packages/lucide-icons => packages/icons

* fix(pnpm): update lockfile

* fix(packages/icons): update readme and documentation

* fix(packages/icons): update absoluteStrokeWidth implementation

* test(packages/icons): update absoluteStrokeWidth unit test

* feat(packages/icons): add backwards compatible alias support in buildLucideIconNode

* feat(packages/icons): fix linting issues in build tools

* fix(packages/icons): rename LucideIcon => LucideIconData

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-03-13 10:18:53 +01:00

3.2 KiB

Aliased Names

Icons can have multiple names for the same icon. This is because we choose to rename some icons to make them more consistent with the rest of the icon set, or the name was not generic. For example, the edit-2 icon is renamed to pen to make the name more generic, since it is just a pen icon.

Beside aliases names lucide also includes prefixed and suffixed names to use within your project. This is to prevent import name collisions with other libraries or your own code.

// These are all the same icon
import {
  House,
  HouseIcon,
  LucideHouse,
} from "lucide-react";

Choosing import name style

To be consistent in your imports or want to change the autocompletion of Lucide icons in your IDE there an option to able the choose the import name style you want.

This can be done by creating a custom module declaration file to override the lucide imports and turning off the autocomplete in your IDE.

Turn off autocomplete in your IDE

{
  "typescript.preferences.autoImportFileExcludePatterns": [
    "lucide-react", // or
    "lucide-preact", // or
    "lucide-react-native", // or
    "lucide-vue-next",
  ]
}

Create a custom module declaration file

Only available for lucide-react, lucide-preact, lucide-react-native, lucide-vue-next package. This will enable you to choose the import name style you want to use in your project.

::: code-group

declare module "lucide-react" {
  // Prefixed import names
  export * from "lucide-react/dist/lucide-react.prefixed";
  // or
  // Suffixed import names
  export * from "lucide-react/dist/lucide-react.suffixed";
}
declare module "lucide-vue-next" {
  // Prefixed import names
  export * from "lucide-vue-next/dist/lucide-vue-next.prefixed";
  // or
  // Suffixed import names
  export * from "lucide-vue-next/dist/lucide-vue-next.suffixed";
}
declare module "lucide-preact" {
  // Prefixed import names
  export * from "lucide-preact/dist/lucide-preact.prefixed";
  // or
  // Suffixed import names
  export * from "lucide-preact/dist/lucide-preact.suffixed";
}
declare module "lucide-react-native" {
  // Prefixed import names
  export * from "lucide-react-native/dist/lucide-react-native.prefixed";
  // or
  // Suffixed import names
  export * from "lucide-react-native/dist/lucide-react-native.suffixed";
}
declare module "@lucide/icons" {
  // Prefixed import names
  export * from "@lucide/icons/dist/lucide-icons.prefixed";
  // or
  // Suffixed import names
  export * from "@lucide/icons/dist/lucide-icons.suffixed";
}

:::

Place this in your project root or in a folder where your tsconfig.json is located, or locate it in your defined type directory. Easiest way is to create a @types folder in your project root and name the file [package-name].d.ts.

Import name styles

Import Style Available imports Declaration file import
Default Home, HomeIcon, LucideHome
Prefixed LucideHome [package].prefixed
Suffixed HomeIcon [package].suffixed