Description
Which exact UI Library version are you using? For example: 1.0.1 - don't just write v1.
1.8.2
Bug summary
As the title describes, I would like to use The @umbraco-ui/uui web components in a vue app. Vue supports the use of web components, yet I cannot seem to get this to work.
I created a simple vue app using pnpm create vue@latest then I follow the steps over at https://vuejs.org/guide/extras/web-components#using-custom-elements-in-vue. (I can provide my vite config if need be, let me know.)
Then I pnpm add @umbraco-ui/uui-button, remove everything from App.vue, render the web component like so:
<script setup lang="ts"> import '@umbraco-ui/uui-button'; </script>No dice! The error chunk-2OPG2DWD.js?v=5cdc5437:9659 Uncaught DOMException: Failed to construct 'CustomElement': The result must not have attributes is thrown and the element does not work.
As far as my understanding about web components & vue goes; built lit components should work in vue. Am I doing something wrong or does @umbraco-ui not support this?
FYI: Originally posted on the Umbraco discord server.
Specifics
No response
Steps to reproduce
- Create a basic vue app using pnpm create vue@latest
- Add uui package pnpm add @umbraco-ui/uui-button
- Tell vue to not handle uui web web components by changing vite config:
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('uui')
}
}
})
],
- Render the button in App.vue:
<script setup lang="ts">
import '@umbraco-ui/uui-button';
</script>
<template>
<div>
<uui-button look="default" color="default" label="Basic">Testing</uui-button>
</div>
</template>
- Run the app using pnpm dev. Go to the url vite spits out.
Expected result / actual result
People should be able to use your lovely uui components inside of front end frameworks that support the use of web components.