Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!