Questions tagged [lit-element]

A base class for creating custom elements with the Lit JS library.

LitElement makes it easy to define web components using /Lit. LitElement allows you to declare reactive properties that re-render the component and reflect to attributes.

It uses to render DOM.

677 questions
0
votes
1 answer

lit-element - How to call an event from a slot button?

element import { LitElement, html } from 'lit-element'; class Component extends LitElement { render () { return html`
jofftiquez
  • 7,548
  • 10
  • 67
  • 121
0
votes
1 answer

Refactor four methods in just two in lit-element

Is it possible to refactor these four methods in just two in lit-element? I have the same counter but duplicate, one for case 0 and one for case 1. As the variables are different, I have done the same method twice to take every variable baceuse I…
user6767724
0
votes
2 answers

litelement - handling click away event

I'm building a site navigation using litelement. It will have a dropdown menu. I am trying to figure out how to add an event so that if a user clicks anywhere outside the dropdown menu itself or even outside of the custom element, the dropdown menu…
aver
  • 555
  • 2
  • 7
  • 21
0
votes
1 answer

lit-element bind to properties of an object that may be null or its subproperties may be null

I have this scenario all the time: a list of entities (say Customer) and a form to edit the selected entity. I bind the form fields to properties of the currently selected entity like this:
NicolasR
  • 2,222
  • 3
  • 23
  • 38
0
votes
1 answer

LitElement shadow root after styles loaded event

I have a problem, I need to handle event after CSS styles was loaded into my component. I was trying to use lit-element lifecycle, still they are fired to early. I'm trying to get my DOM element starting position and other data, but I get an initial…
0
votes
1 answer

How to pass data between lit-element templates?

I am trying to pass data from one component to another. My idea is to have a generic component with buttons that increase or decrease a value and add those specific values ​​to another template. Here is my code with the buttons: import {…
user6767724
0
votes
1 answer

Why the property 'classList' cannot be read?

I am trying to add and remove a class depending on whether a variable is equal to 0. Here is my code: import { LitElement, html } from 'lit-element'; class SelectCounter extends LitElement { static get properties() { return { …
user6767724
0
votes
2 answers

Is it possible to condition a default value in the constructor depending on another value?

I want to set a defalt value in the constructor depends on other value. Here is the template where the type values ​​are: class SelectOption extends LitElement { static get properties() { return { type: {type: Array} …
user6767724
0
votes
1 answer

how to make a method that push items to empty array with lit-element

I have an empty array with lit-element to add the ages between 2 to 13 years that I generate with a loop. I need to add each element within the array using a method but I don't know how to make it work. This is what I have: import { LitElement, html…
user6767724
0
votes
2 answers

Angular banana-in-a-box with webcomponents (LitElement)

I'm using LitElement webcomponents with an angular application I implemented two ways data binding with a CustomEvent dispatch but I would like to use angular's banana-in-a-box syntax sugar. Example : this stackblitz : a webcomponent with an integer…
0
votes
1 answer

.NET Core mvc UseSpa UseProxyToSpaDevelopmentServer serves build version instead of development version

I'm using LitElements to build my frontend. I want to configure .net core mvc spa with it. here how my config looks like: Startup.cs app.UseSpa(spa => { spa.Options.SourcePath = "wwwsrc"; if (env.IsDevelopment()) { …
motemood
  • 41
  • 1
  • 2
0
votes
1 answer

color as an attribute in litelement custom element

I'm building a custom web component with LitElement and would like to give it a color attribute. I've got the color working but its hardcoded. I want the color to change based on user preference. for example,
0
votes
1 answer

Not able to pass JSON stringify data to Lit Element child component in IE Edge browser

I am trying to pass my JSON data(JSON stringify data) to child component in Litelement Compoent. It is working in Chrome. But getting undefined in IE Edge browser
Tech Geek
  • 23
  • 3
0
votes
1 answer

Retrieve properties data from LitElement Web Component

I am trying to create a web component with the following features: 1. click a button to add a