question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: support for shadow dom in Twind v1?

See original GitHub issue

Describe the problem

How to add Tailwind classes inside shadow dom?

Describe the proposed solution

There was a nice documentation about adding support for shadow DOM for the beta version https://twind.dev/usage-guides/web-components.html, but the required classes create and cssomSheet are not present in the latest version. This is also not mentioned in the migration guide.

Alternatives considered

No response

Importance

I cannot use Twind without it

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
GorvGoylcommented, Dec 15, 2022

@sastan, thanks; it seems to be working for me. I also wrote small guide in case others are looking for the solution https://gourav.io/blog/tailwind-in-shadow-dom

0reactions
GorvGoylcommented, Dec 16, 2022

@sastan I’ll give you some context… I’m developing a chrome extension and need to show some UI using shadow DOM on web pages so that the styles don’t get leaked to the page. You’re right that @twind/with-web-components won’t be helpful in my case as I’m not using lit or web components. If you could provide @twind/with-shadow-root that abstracts away the code, that’d be nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shadow DOM (V1) | Can I use... Support tables for ... - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >
[Feature] Support Shadow DOM v1 #403 - basecamp/trix
I am requesting support for Shadow DOM as a feature because there are just too many bugs to try to describe. When Trix...
Read more >
Shadow DOM v1 - Self-Contained Web Components
Shadow DOM allows web developers to create compartmentalized DOM and CSS for web components.
Read more >
Use with Web Components - Twind
Custom Elements and Shadow DOM. This example shows how Custom Element can have its styles separated without having the side effect of polluting...
Read more >
Using shadow DOM - Web Components | MDN
Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree — this shadow DOM tree starts with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found