Using Plasmo with Mantine

I was able to successfully use https://mantine.dev/ for all my react components in the google extension popup, but I'm not able to get it to properly render the components in the injected react components
AppShell demo
React components and hooks library with native dark theme support and focus on usability, accessibility and developer experience
22 Replies
lab
lab•2y ago
Ooh we have the core maintainer of mantine on the server, and some other who were able to use it in their extension as well We should add an example for it lol But basically, you will need to extract the style from mantine and inject it into the CSUI via the getStyle function
lab
lab•2y ago
Since mantine uses emotion, follow this setup: https://github.com/PlasmoHQ/examples/tree/main/with-emotion
GitHub
examples/with-emotion at main · PlasmoHQ/examples
🔰 Example projects that demonstrate how to use the Plasmo Framework and integrate with popular tools - examples/with-emotion at main · PlasmoHQ/examples
lab
lab•2y ago
Or make an easy to use guide for it, or maybe send a PR to mantine UI with an example on how to use mantine with Plasmo since it's a pretty sizable dependency ;d
MoreThanYourAverageJoe#3911
how're you able to extract the styles from mantine?
Arcane
Arcane•2y ago
@MoreThanYourAverageJoe has reached level 3. GG!
lab
lab•2y ago
GitHub
mantine/emotion-cache.mdx at master · mantinedev/mantine
React components library with native dark theme support - mantine/emotion-cache.mdx at master · mantinedev/mantine
lab
lab•2y ago
BTW, it would be really nice to add a plasmo guide to mantine in here: https://github.com/mantinedev/mantine/blob/master/docs/src/docs/guides/typescript.mdx
GitHub
mantine/typescript.mdx at master · mantinedev/mantine
React components library with native dark theme support - mantine/typescript.mdx at master · mantinedev/mantine
lab
lab•2y ago
a /guides/plasmo.tsx
MoreThanYourAverageJoe#3911
i'll come around to doing that within the next couple of days i'm still trying to figure this out still kind of confused as how to fully use the getStyle function, would I have to inject the css for every single component?
MoreThanYourAverageJoe#3911
what about for components like: https://mantine.dev/core/multi-select/
MultiSelect
Custom searchable multi select
MoreThanYourAverageJoe#3911
I'd have to inject he css for. them all?
lab
lab•2y ago
no, you only need to return the style from the emotionCache see contents.tsx for the base idea:
lab
lab•2y ago
GitHub
examples/content.tsx at main · PlasmoHQ/examples
🔰 Example projects that demonstrate how to use the Plasmo Framework and integrate with popular tools - examples/content.tsx at main · PlasmoHQ/examples
lab
lab•2y ago
mantine/emotion will generate the runtime style and send them to that custom cache, which in turn get rendered into the style tag by the getStyle function in CSUI which in turn, get mounted onto the ShadowDOM for you by plasmo
MoreThanYourAverageJoe#3911
gotchu okay i get it I'll create a quick guide within the next few days and submit a PR to mantine thank you!
Want results from more Discord servers?
Add your server