Skip to content

Is it possible to use DaisyUI for an embeddable widget without leaking styles to consumer app? #2845

Closed Answered by saadeghi
knajjars asked this question in Q&A
Discussion options

You must be logged in to vote

It's a common practice to use iframe when you want to inject a widget in another website. Almost every site does this about embedding (Youtube, Facebook, Twitter, etc)
Because usually you wouldn't want the host website ti manipulate the content or style of your widget in anyway.
But if you don't want to use iframe, there are other solutions like adding a prefix to class names, scoping and mangling styles, or using PostCSS plugins for other style manipulations.
About the base styles, daisyUI has a themeRoot config where you can set a specific CSS selector instead of document root.

Apart from daisyUI, Tailwind CSS has some global reset styles called preflight. Don't disable it, but you can …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saadeghi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants