Paste your SVG code below to generate an optimized sprite. Why?
Still not convinced? Read more about it on Ben Adam blog post, Jacob Paris blog post or Kent C. Dodds' Epic Stack documentation
sprite.svg
in the assets folder of your project.
<svg class="w-6 h-6">
<use href="/sprite.svg#icon-name" />
</svg>
import React from 'react';
const Icon = ({ name, ...props }) => (
<svg {...props}>
<use href={`/sprite.svg#${name}`} />
</svg>
);
export default Icon;
And then use it like this:
<Icon name="icon-name" className="w-6 h-6" />
<script>
export let name = '';
</script>
<svg {...$$props}>
<use xlink:href={`/sprite.svg#${name}`} />
</svg>
And then use it like this:
<Icon name="icon-name" className="w-6 h-6" />
Built by José Donato using Sveltekit, TailwindCSS and melt-ui.