VS Code Codicons as Svelte components.
This zero-dependency library uses svelvg to convert SVG files from the @vscode/codicons into Svelte components.
Try it in the Svelte REPL.
# NPM
npm i -D svelte-codicons
# pnpm
pnpm i -D svelte-codicons
# Bun
bun add -D svelte-codicons
# Yarn
yarn add -D svelte-codicons
<script>
import { Add, Calendar, Edit } from "svelte-codicons";
</script>
<Add />
<Calendar />
<Edit />
Refer to ICON_INDEX.md for a list of supported icons.
Use the direct import for faster compiling during development.
<script>
import Add from "svelte-codicons/lib/Add.svelte";
</script>
<script>
import * as icons from "svelte-codicons";
</script>
{#each Object.entries(icons) as [icon, component]}
<div>
<svelte:component this={component} />
{icon}
</div>
{/each}
$$restProps
are forwarded to the svg
element.
Use the width
and height
attributes to customize the icon size. The default is 16px.
<Add width={36} height={36} />
Use the fill
attribute to specify a custom color.
<Add fill="red" />
vscode-codicons
is licensed as CC-BY-4.0.