feat(@lucide/solid): Support for Solid 2.0 RC (#4751)

* Updates needed to support Solid 2

* Switch to the next tag

* feat(packages): add `@lucide/solid` package for Solid 2

Solid 2's API is a breaking change from Solid 1 and is still an RC, so
`lucide-solid` stays on Solid 1 (`solid-js: ^1.4.7`) untouched and Solid 2
support ships as a new `packages/solid` package named `@lucide/solid` —
the same scheme already used by `@lucide/svelte` and `@lucide/angular`.

The package is a copy of `lucide-solid` on the `@lucide/shared` build
architecture, ported to Solid 2:

- `splitProps` -> `omit`, `solid-js/web` -> `@solidjs/web`,
  `JSXElement` -> `Element`, `Context.Provider` -> `<Context value>`
- `jsxImportSource` is `@solidjs/web` in tsconfig, the esbuild step and
  `ts.createProgram`; rollup externals drop the removed `solid-js/store`
- `vite-plugin-solid` -> `@solidjs/vite-plugin`
- tests keep upstream's coverage with two Solid 2 adaptations: boolean
  attribute literals must be strings (`aria-hidden="false"`), and writes
  are batched so the reactivity tests need a `flush()` before asserting

Rendered output is unchanged — the snapshots are byte-identical to
`lucide-solid`'s.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(solid): fix React leftovers in the Solid guide

The Solid guide was derived from the React guide and three things were
not carried across:

- `advanced/typescript.md` still told readers the types are for "a
  TypeScript React project"
- its `LucideIcon` example kept React's destructured-props signature.
  The `: ButtonProps` annotation had also been dropped in the copy, so
  `ButtonProps` was declared but unused and the parameters were
  implicitly `any`. Destructuring props breaks reactivity in Solid —
  verified: with `({ icon: Icon, label })` a changing `label` never
  reaches the DOM, while `props.label` updates correctly.
- `advanced/aliased-names.md` had an orphaned `###` heading; its parent
  `## Choosing import name style` was dropped during the conversion
  because it documents React-only subpath exports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs: type the shared Sandpack wrapper with `SandpackProps`

The base Sandpack wrapper declared its props as
`FunctionalComponent<LucideProps>` with `LucideProps` imported from
`@lucide/vue`, which has nothing to do with a Sandpack embed. None of
the props the markdown plugin actually passes (`template`, `files`,
`options`, `customSetup`, `theme`) were declared, so they only reached
the inner `<Sandpack />` via Vue's fallthrough attributes.

Declare `SandpackProps` from `sandpack-vue3` instead and forward them
explicitly. This also removes the `@lucide/vue` import that made every
framework guide — including the Solid one, which uses this wrapper
directly — appear to reference the Vue package.

Verified with a full `vitepress build`: each framework guide's chunk
still carries its own template (react/vue/vite-svelte/vanilla/
vite-solid) and all five props reach the component.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(solid): document the Solid 2 flavour in the getting started guide

The Solid guide teaches `lucide-solid` throughout (64 references), so
the one-line note about `@lucide/solid` left Solid 2 readers on a page
whose every install command and live example is Solid 1 — and the
packages list points `@lucide/solid` at this same page.

Replace that note with a "Using Solid 2?" callout holding its own
tabbed install group, the import-specifier swap, and a table of the
Solid 2 changes that affect code written around Lucide (`@solidjs/web`,
`jsxImportSource`, `splitProps` -> `omit`, `<Ctx value>`), linking out
to Solid's own migration guide for the rest.

The claim that both packages expose the same components and props is
checked, not assumed: `dist/types/lucide-solid.d.ts` is identical
between the two packages, and the only differences anywhere in the
public type surface are Solid's own renames (the `JSX` namespace source
and `JSXElement` -> `Element`).

Keeps one guide section for both packages, matching how upstream
handles the two Svelte packages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(solid): port lucide-solid to Solid 2

- Icon/context/types use Solid 2 APIs: omit() instead of splitProps(),
  Dynamic and JSX types from @solidjs/web.
- solid-js / @solidjs/web 2.0 (rc) as peer and dev dependencies,
  babel-preset-solid 2; rollup and tsconfig updated to match.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Add integration test

* Update rollup file

* Fix tests

* Revert lucide-solid changes

* update lockfile

* Fix docs

* Format code

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Eric <eric.fennis@gmail.com>
This commit is contained in:
David Di Biase
2026-10-02 19:02:20 +02:00
committed by GitHub
co-authored by Claude Opus 5.5 Eric
parent 0c0e3ab3ae
commit 4b3f93d9d0
53 changed files with 2230 additions and 43 deletions
@@ -41,7 +41,6 @@ export default eventHandler((event) => {
<Diff
oldSrc={oldSrc}
newSrc={newSrc}
showGrid
height={height}
width={width}
>
@@ -48,7 +48,6 @@ export default eventHandler((event) => {
<Diff
oldSrc={oldSrc}
newSrc={newSrc}
showGrid
height={height}
width={width}
>
+6 -5
View File
@@ -18,11 +18,12 @@ export default eventHandler((event) => {
return sendError(event, error);
}
const width = getQuery(event).width || undefined;
const height = getQuery(event).height || undefined;
const color = getQuery(event).color || undefined;
const strokeWidth = getQuery(event).strokeWidth || undefined;
const background = getQuery(event).background || undefined;
const query = getQuery<Record<string, string | undefined>>(event);
const width = query.width || undefined;
const height = query.height || undefined;
const color = query.color || undefined;
const strokeWidth = query.strokeWidth || undefined;
const background = query.background || undefined;
const LucideIcon = createLucideIcon(params.iconName, iconNode);
+20 -2
View File
@@ -85,8 +85,26 @@
}
]
},
"lucide-react-native": {
"@lucide/solid": {
"order": 5,
"icon": "solid",
"docsAlias": "solid",
"packageDirname": "solid",
"shields": [
{
"alt": "npm",
"src": "https://img.shields.io/npm/v/@lucide/solid",
"href": "https://www.npmjs.com/package/@lucide/solid"
},
{
"alt": "npm",
"src": "https://img.shields.io/npm/dw/@lucide/solid",
"href": "https://www.npmjs.com/package/@lucide/solid"
}
]
},
"lucide-react-native": {
"order": 6,
"icon": "react-native",
"docsAlias": "react-native",
"shields": [
@@ -103,7 +121,7 @@
]
},
"@lucide/angular": {
"order": 6,
"order": 7,
"icon": "angular",
"docsAlias": "angular",
"packageDirname": "angular",
+8 -5
View File
@@ -397,10 +397,14 @@ interface SvgPreviewProps extends React.SVGProps<SVGSVGElement> {
children?: React.ReactNode;
}
const SvgPreview = (
{ src, children, height = 24, width = 24, showGrid = false, ...props }: SvgPreviewProps,
ref,
) => {
const SvgPreview = ({
src,
children,
height = 24,
width = 24,
showGrid = false,
...props
}: SvgPreviewProps) => {
const subGridSize =
Math.max(height, width) % 3 === 0
? Math.max(height, width) > 24
@@ -413,7 +417,6 @@ const SvgPreview = (
return (
<svg
ref={ref}
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
@@ -1,13 +1,11 @@
<script lang="ts" setup>
import { type FunctionalComponent } from 'vue';
import { type LucideProps } from '@lucide/vue/src/types';
import { Sandpack } from 'sandpack-vue3';
import { Sandpack, type SandpackProps } from 'sandpack-vue3';
defineProps<FunctionalComponent<LucideProps>>();
const props = defineProps<SandpackProps>();
</script>
<template>
<Sandpack />
<Sandpack v-bind="props" />
</template>
<style>
+1
View File
@@ -153,6 +153,7 @@ deno add lucide-solid
```
:::
> `@lucide/solid` is for Solid 2, for Solid 1 use the `lucide-solid` package. Solid 2 is still a release candidate.
For more details, see the [documentation](./solid/index.md).
+1 -1
View File
@@ -18,7 +18,7 @@ import {
} from "lucide-solid";
```
### Turn off autocomplete in your IDE
## Turn off autocomplete in your IDE
```json [.vscode/settings.json]
{
+4 -4
View File
@@ -6,7 +6,7 @@ description: Learn about the different types exported by the `lucide-solid` pack
# TypeScript Support
List of exported types from the `lucide-solid` package.
These can be used to type your components when using Lucide icons in a TypeScript React project
These can be used to type your components when using Lucide icons in a TypeScript Solid project.
## `LucideProps`
@@ -61,10 +61,10 @@ interface ButtonProps {
label: string;
}
const IconButton = ({ icon: Icon, label }) => {
const IconButton = (props: ButtonProps) => {
return (
<button aria-label={label}>
<Icon size={16} />
<button aria-label={props.label}>
<props.icon size={16} />
</button>
);
};
+46
View File
@@ -36,6 +36,52 @@ bun add lucide-solid
:::
:::: info 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:
::: code-group
```sh [pnpm]
pnpm add @lucide/solid
```
```sh [yarn]
yarn add @lucide/solid
```
```sh [npm]
npm install @lucide/solid
```
```sh [bun]
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 package | `solid-js/web` | `@solidjs/web` |
| `jsxImportSource` | `solid-js` | `@solidjs/web` |
| Splitting icon props | `splitProps(props, ['size'])` | `omit(props, 'size')` |
| Providing context | `<Ctx.Provider value={…}>` | `<Ctx value={…}>` |
See the [Solid 2 migration guide](https://github.com/solidjs/solid/blob/next/documentation/solid-2.0/MIGRATION.md) 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.
+2
View File
@@ -34,6 +34,8 @@
"@lucide/helpers": "workspace:*",
"@lucide/shared": "workspace:*",
"@rollup/plugin-replace": "^6.0.3",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"@types/semver": "^7.8.0",
"h3": "^1.15.11",
"markdown-it": "^15.0.1",