Viget
Read post

Embeddable Widgets with Vite, React, Tailwind 4 & Web Components

A practical walkthrough of building embeddable widgets using React, Tailwind 4, Vite, and Web Components delivered as a single JS file. Two significant browser limitations are uncovered and solved: Tailwind 4's heavy reliance on CSS @property rules which Shadow DOM doesn't fully support, and @font-face declarations not working inside Shadow Roots. The @property issue is addressed with a custom PostCSS plugin (~300 lines) that transforms Tailwind's property registrations into concrete CSS variable declarations scoped to the shadow host. The font issue is handled by a runtime font loader using the FontFace API that attaches fonts to the parent document instead of the Shadow Root.

    #react#html#tailwind-css#vite#web-components
Jun 23•11m read time•From viget.com
Post cover image
Table of contents
So how is this supposed to work? #The Initial Setup. #Our first problem: “Where are my borders?” #Our second problem: “Where are my fonts?” #Closing thoughts #
37.8K Impressions1 Comment
Viget's image
Viget

Viget is a digital agency specializing in web design, development, and digital marketing. Readers ca...

40 Followers

•

755 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard