3,851 questions
3 votes
2 answers
74 views
Why isn't the class style applied and the button working inside the webcomponent
I am trying to understand how to make a web component with attributes. There is 2 problems I don't understand in the following code: The div with the text 'the style of class is not applied' doesn't ...
1 vote
0 answers
55 views
How to make custom Web Components with Tailwind CSS react to container width instead of window.innerWidth? [closed]
I'm building an embedded widget as a Web Component using Vite + Tailwind CSS. When the app runs standalone, Tailwind responsive breakpoints (sm, md, lg, xl) work correctly, because they react to ...
2 votes
1 answer
64 views
How to pass an object programmatically to an Angular custom element (@angular/elements)?
I’m trying to pass an object as an input to an Angular custom element created with @angular/elements, not via HTML attributes (since setAttribute only supports strings). Here’s a minimal example: ...
2 votes
1 answer
53 views
Angular Elements – setting `@Input()` property programmatically doesn’t update component
I’m experimenting with Angular Elements and trying to update an input property programmatically, not by writing it in HTML like <app-foo name="...">. Here’s a minimal example: import { ...
0 votes
1 answer
241 views
Is ":host::part()" a valid CSS selector?
When I asked Google AI it responded: Why combining them is wrong The selector :host::part() attempts to mix these two concepts incorrectly: It tries to select an element with part="base". ...
0 votes
1 answer
67 views
Issue while loading primeicons css resources into shadow dom
I would like to properly load css and icons into my web component, right now styles are loaded but icons are not. Here is my web component: import React from "react"; import { createRoot } ...
2 votes
3 answers
197 views
How to style elements in the shadow DOM from a child element within the custom element
I'm creating a web component, and I would like the user/webmaster to be able to style elements in the shadow DOM without touching the JavaScript class. In the example I have a style element as a child ...
0 votes
0 answers
107 views
How do I consume a third-party web component in a Nuxt app?
Is there a tutorial about how to use Web Components in a Nuxt app? I am trying to include one in my app. First, I created a Vue app and figured out how to use it there and I got it working perfectly. ...
1 vote
1 answer
175 views
Web Component causing Layout Shift
I'm creating a plain vanilla website, and many pages of my website has a component in common (a sidebar), so I created a Web Component to easily include in all pages. The class of the component: //...
1 vote
1 answer
139 views
How to Build to a Web Component from a Svelte Library?
I'm writing a Svelte(Kit) library that currently works by importing the svelte component. I've been requested to make it also available as a web component, i.e. something like: <script src="...
1 vote
1 answer
157 views
Web Components: Slots are not working as (I) expected in light DOM
How can I change the following light DOM custom element to show the content of the default slot between (!!!) the two horizontal rulers? Please be aware, that I cannot use shadow DOM in my use case. &...
1 vote
1 answer
108 views
Why do I need to set the `height` when `min-height` is already set? [duplicate]
Here's a problem that I don't understand; it may be related to the shadow root (or the grid) but I must set the height (to for eg. to 0, see the commented property in the CSS) for min-height to apply ...
0 votes
2 answers
71 views
TypeScript support for vanilla custom element classes
I have an app with vanilla custom elements, like this: class CardComponent extends HTMLElement { static get observedAttributes() { return ['header', 'text']; } constructor() { super(); ...
0 votes
1 answer
44 views
How to call onclick events written on div through jest (salesforce)?
I have created an LWC in Salesforce and am trying to creat Jest tests for it. I have implemented a div in html file and calling the js function using the onclick event as shown below. <div class=&...
0 votes
0 answers
44 views
Delaying render of webcomponent content
I have a website that uses webcomponents to add some extra interactivity. In this case a carousel created in Svelte <svelte:options customElement={{ tag: "carousel", shadow: "...