Using Vue 3.2.41 - @heroicons/vue 2.0.14 - inertiajs 1.0 - vite 4.0.0
I'm calling a Vue component using this:
<TimelineItem icon="CalendarDaysIcon" />
The component looks like this:
<template>
<component :is="icon" /> <!-- doesn't work -->
<CalendarDaysIcon /> <!-- works -->
</template>
<script setup>
import {
CalendarDaysIcon,
} from '@heroicons/vue/20/solid'
const props = defineProps(['icon'])
</script>
The HTML being rendered is like this:
<calendardaysicon></calendardaysicon> <!-- not what I want -->
<svg> ... </svg> <!-- correct but not dynamic -->
In other words, the <component :is /> is just rendering some empty <calendardaysicon> tags when I'd expect it to render the component. I can see that it has made it lowercase and have no idea how to force it back to PascalCase and I'm not even sure if that would help the situation.
I've simplified the code somewhat, but the full version would have a list of 10 different icons (all part of the Heroicons package which uses PascalCase names) which I'd like to be able to call easily from the main component.
TimelineItem<TimelineItem icon="CalendarDaysIcon" />is correct because the template is rendering, as is the<CalendarDaysIcon />within it.