Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
Twind Configuration not working with LitElement

I can't seem to get theme working with LitElement. I can set the other props of setup no problem, but the theme doesn't get recognized by Twind. It's also worth mentioning that I get no error when compiling. Anyone have a quick solution?

import {LitElement, html} from 'lit';
import {setup, warn, create, cssomSheet} from 'twind';

setup({
  mode: warn,
  theme: {
    colors: {
      purple: '#2013',
    },
  },
});

const sheet = cssomSheet({target: new CSSStyleSheet()});
const {tw} = create({sheet});

export class MyApp extends LitElement {
  static styles = [sheet.target];

  static get properties() {
    return {
      name: {type: String},
    };
  }

  constructor() {
    super();
    this.name = 'World';
  }

  render() {
    return html` <h1 class="${tw`text(3xl purple)`}">${this.name}!</h1> `;
  }
}

window.customElements.define('my-app', MyApp);

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Probably, the problem is the shadow-dom. If you can use Twind, you can try to render to light-dom, instead shadow-dom.

To use light-dom add in your web-component class this method:

createRenderRoot() {
  return this;
}

In other hand, I don't sure it works without Lit...

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda