svgworm docs
One command sets a project up. Then pick your framework.
pnpm add -D svgworm && pnpm svgworm init
With npm: npm install -D svgworm && npx svgworm init. React and Next.js also need @svgworm/react.
Set up
Next.js App Router setup
Set up svgworm in a Next.js App Router app. A hashed sprite from your SVG folder and type-checked icons in Server Components, with zero client JS.
Astro setup
Set up svgworm in an Astro 7 site. A generated Icon.astro renders type-checked icons from a hashed sprite, with no React and no client JS.
Vite + React setup
Set up svgworm in a Vite and React app. A hashed sprite from your SVG folder and type-checked icons, with the Vite base and cache headers covered.
Vue and Nuxt setup
Set up svgworm in a Vue 3.5 or Nuxt app. A generated Icon.vue renders type-checked icons from a hashed sprite, with no runtime dependency.
Svelte and SvelteKit setup
Set up svgworm in a Svelte 5 or SvelteKit app. A generated Icon.svelte renders type-checked icons from a hashed sprite, with no runtime dependency.
Reference
- Icon componentEvery prop of the React Icon and the generated Icon.astro, Icon.vue and Icon.svelte, the markup each icon delivery renders (svg, img or a CSS mask), and how to size and color icons with CSS.
- CLI referenceEvery svgworm command, flag and exit code: build sprites, check committed output in CI, watch for changes and set a project up, with stable --json output.
- ConfigEvery svgworm.config.json key and its default, per-icon color overrides, and the JSON Schema that editors and AI agents validate against.
- TroubleshootingFixes for the problems people hit with svgworm: a blank icon in Safari, a sprite that 404s, an icon in the wrong color, name collisions, svgworm check failing in CI, and every diagnostic code with its fix.
- How it worksThe model behind the files svgworm writes: one external sprite plus a stack file, why each icon gets a use, img or mask delivery, what the manifest and types carry, how names are derived, and why the output is byte-identical everywhere.
Coming from SVGR, @neodx/svg or a Vite plugin? Read the Comparison, with the numbers behind each claim. On SVGR, Migrate from SVGR rewrites your imports with one command.