Skip to content

Getting started ​

This guide will help you get started with Lucide in your Solid project. Make sure you have a Solid environment set up. If you don't have one yet, you can create a new Solid project using Create Solid App, Vite, or any other Solid boilerplate of your choice.

Installation ​

sh
pnpm add lucide-solid
sh
yarn add lucide-solid
sh
npm install lucide-solid
sh
bun add lucide-solid

Using Solid 2?

Lucide ships one package per major Solid version. This guide covers Solid 1 and the lucide-solid package. If your app is on Solid 2, install @lucide/solid instead:

sh
pnpm add @lucide/solid
sh
yarn add @lucide/solid
sh
npm install @lucide/solid
sh
bun add @lucide/solid

Both packages export the same icon components with the same props, so the rest of this guide applies unchanged — only the import specifier differs:

jsx
import { Camera } from '@lucide/solid';

What does differ is Solid itself. The changes most likely to affect the code you write around Lucide:

lucide-solid@lucide/solid
Solid version^1.4.7^2.0.0-rc.0
DOM runtime packagesolid-js/web@solidjs/web
jsxImportSourcesolid-js@solidjs/web
Splitting icon propssplitProps(props, ['size'])omit(props, 'size')
Providing context<Ctx.Provider value={…}><Ctx value={…}>

See the Solid 2 migration guide for the full list.

Solid 2 is still a release candidate, so treat @lucide/solid as pre-release too. The live examples throughout this guide run on Solid 1.

Importing your first icon ​

Lucide is built with ES Modules, so it's completely tree-shakable.

Each icon can be imported as a Solid component, which renders an inline SVG element. This way, only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.

jsx
import { Camera } from 'lucide-solid';

// Usage
const App = () => {
  return <Camera />;
};

export default App;

Props ​

To customize the appearance of an icon, you can use the following props:

nametypedefault
sizenumber24
colorstringcurrentColor
strokeWidthnumber2
nonScalingStrokebooleanfalse

Because icons render as SVG elements, all standard SVG attributes can also be applied as props. See the list of SVG Presentation Attributes on MDN.

jsx
// Usage
const App = () => {
  return (
    <Camera
      size={48}
      color="red"
      strokeWidth={1}
    />
  );
};

More examples and details how to use props, continue the guide: