The component is designed for displaying your SVG icons
All available props see in SvgIcon.props.ts
<template>
<svg-icon name="arrow-right" />
<svg-icon name="arrow-right" rotate />
</template>
<script setup lang="ts">
import { SvgIcon } from '@tok/ui/components/SvgIcon';
</script>
<template>
<svg-icon name="arrow-right" />
<svg-icon name="fancy-icon" />
</template>
<script setup lang="ts">
import { SvgIcon } from '@tok/ui/components/SvgIcon';
import { CUSTOM_ICONS_TOKEN } from '@tok/ui/tokens';
import { defineAsyncComponent, provide } from 'vue';
const icons = {
// defineAsyncComponent is important because we are using vite-svg-loader to render icons as component
'arrow-right': defineAsyncComponent(() => import('./custom/arrow-right.svg')),
'fancy-icon': defineAsyncComponent(() => import('./custom/fancy-icon.svg')),
};
provide(CUSTOM_ICONS_TOKEN, icons);
</script>
By default, the icon size is set to a width of 1.5em and a height of 1.5em.
You can customize this by passing a prop to the SvgIcon component, where the size is specified in pixels (px)
<template>
<svg-icon name="arrow-right" :size="12" />
<svg-icon name="arrow-right" :size="[12, 56]" />
</template>
<script setup lang="ts">
import { SvgIcon } from '@tok/ui/components/SvgIcon';
</script>