Files
aigc-home/calliope-web/src/lib/components/ui/Icon.svelte
T

39 lines
859 B
Svelte

<script lang="ts">
import { icons, type IconName } from "./icons";
interface Props {
name: IconName;
size?: number;
}
let { name, size = 18 }: Props = $props();
const content = $derived(icons[name] ?? "");
</script>
{#if content}
<svg
class="icon"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
style:stroke-width="var(--icon-stroke, 1.5)"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<!-- eslint-disable-next-line svelte/no-at-html-tags -- content is selected only from the bundled icons.ts SVG registry; no API/user strings enter it. HTML preserves the authored SVG child elements. -->
{@html content}
</svg>
{/if}
<style>
.icon {
display: inline-block;
vertical-align: -0.125em;
flex-shrink: 0;
}
</style>