A CLI tool to fetch Lucide icons from GitHub raw files and save it directly to your working directory.
This CLI tool is inspired by and based on Lucide icons.
It uses the raw files from thelucide/icons
folder to fetch the icons.
This CLI tool currently supports React
framework only.
New features and frameworks will be added in due time.
Support for both TypeScript
and JavaScript
is available.
-
Initial the tool to your project by running the following command:
npx lucide-cli init
This will also install the tool automatically, if not installed previously.
-
You will be asked to select the framework you are using.
ℹ Welcome to Lucide CLI - <0.0.0> #current version ? Select the framework you are using: (Use arrow keys) ❯ React
Currently, only
React
is supported. -
Next, you will be asked whether you are using
TypeScript
or not.? Are you using TypeScript? (Use arrow keys) ❯ Yes No
-
After this, you will be asked to provide the directory where you want to save the icons.
? Where do you want to save the icons? (src/components/lucide)
The default directory is
src/components/lucide
. -
Next, you will be asked to provide the default size and stroke width for the icons.
? Default size for the icons: (24) ? Default stroke width for the icons: (2)
The default size is
24
and the default stroke width is2
. -
After providing the directory, the tool will initialize the configuration and save it to the
lucide.config.json
file.✔ Configuration file created successfully ✔ Icon directory created successfully ✔ TypeScript definitions file created successfully ✔ Lucide CLI has been successfully initialized
-
That's it.
Now you can start adding the icons to your project.
npx lucide-cli add <icon-names...>
To add an icon to your project, run the following command:
npx lucide-cli add <icon-names...>
# Example
npx lucide-cli add activity
npx lucide-cli add plus
# You can also add multiple icons at once:
npx lucide-cli add activity plus
To remove an icon from your project, run the following command:
npx lucide-cli remove <icon-names...>
# Example
npx lucide-cli remove activity
npx lucide-cli remove plus
# You can also remove multiple icons at once:
npx lucide-cli remove activity plus
To list all the icons which are already added to your project, run the following command:
npx lucide-cli list
# ⠋ Looking for icons...
# ℹ - activity
# ℹ - plus
# ✔ Found 2 icons in your project
To update the icon, to match the latest configuration file, run the following command:
npx lucide-cli update
Adding icon will always use the latest configuration file.
So you can also update specific icons by adding them again.
npx lucide-cli add <icon-names...>
If you selected TypeScript, the tool will automatically create a TypeScript definitions file for you in the directory you provided with the name .lucide.d.ts
.
All the icons added with TypeScript will use type definitions from this file.
You can change your project configuration by editing the lucide.config.json
file.
Or you can re-initialize the configuration by running the following command:
npx lucide-cli init
{
"framework": "React",
"typescript": false,
"iconsDirectory": "src/components/lucide",
"defaultSize": 24,
"defaultStrokeWidth": 2
}
Always update icons after changing the configuration.
npx lucide-cli update
If you change the directory, the tool will not remove the icons from the previous directory. You have to remove them manually.
You can also use the CLI command to get the configuration details.
npx lucide-cli config
You can also use aliases for all the commands.
npx lucide-cli a <icon-names...> # Add Icon
npx lucide-cli i <icon-names...> # Add Icon
npx lucide-cli install <icon-names...> # Add Icon
npx lucide-cli r <icon-names...> # Remove Icon
npx lucide-cli rm <icon-names...> # Remove Icon
npx lucide-cli remove <icon-names...> # Remove Icon
npx lucide-cli d <icon-names...> # Remove Icon
npx lucide-cli del <icon-names...> # Remove Icon
npx lucide-cli delete <icon-names...> # Remove Icon
npx lucide-cli l # List Icons
npx lucide-cli ls # List Icons
npx lucide-cli u # Update Icons
npx lucide-cli up # Update Icons
npx lucide-cli upgrade # Update Icons
npx lucide-cli refresh # Update Icons
npx lucide-cli c # Configuration
You can test the configuration and server connection by running the following command:
npx lucide-cli test
This project is licensed under the MIT License - see the LICENSE file for details.
Original Lucide Icon Library is licensed under the ISC License - see the LICENSE file for details.