GitHub Octicons as Svelte components.
This library builds GitHub Primer Octicons as Svelte components with zero dependencies.
Try it in the Svelte REPL.
# npm
npm i -D svelte-octicons
# pnpm
pnpm i -D svelte-octicons
# Bun
bun i -D svelte-octicons
# Yarn
yarn add -D svelte-octicons
Refer to ICON_INDEX.md for a list of available icons.
$$restProps
are forwarded to the svg
element.
<script>
import { Alert16, Diamond16, Rocket16, Video16 } from "svelte-octicons";
</script>
<Alert16 />
<Diamond16 />
<Rocket16 />
<Video16 />
<Alert16 fill="red" />
svelte:component
<script>
import * as Octicons from "svelte-octicons";
</script>
{#each Object.entries(Octicons) as [octicon, component]}
<div>
<svelte:component this={component} />
{octicon}
</div>
{/each}
Svelte version 3.31 or greater is required to use this library with TypeScript.