Define stylis plugins through ThemeProvider (or similar)?
See original GitHub issueWould it be possible to add a way to define stylis plugins through some context API rather than the create-emotion
package?
I find the need to use a custom stylis plugin for some accessibility features and I don’t feel confident in asking my users to use a custom Emotion package just for my library needs.
Ideally it would look like this:
import { ConfigProvider } from 'emotion';
<ConfigProvider stylisPlugins={...} prefix="..." key="..." container="..." etc>
<StyledComponentAffectedByConfigHere />
</ConfigProvider>
would this be something possible?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Advanced Usage - styled-components
styled-components has full theming support by exporting a <ThemeProvider> wrapper component. ... Define what props.theme will look like. const theme = {.
Read more >Advanced (LEGACY) - MUI System
Add a ThemeProvider to the top level of your app to pass a theme down the React component tree. Then, you can access...
Read more >Theming in React with Styled Components | by Ross Bulat
As you may know, styled components utilise template literals as a means of defining styles directly into your component files:
Read more >How To Use React Styled Components Efficiently - Copycat
What is styled-components? Why styled-components? How to use Styled Components in React; Installation; Syntax. SCSS-like Syntax: Stylis.
Read more >JSS integration with React
Remember, since React-JSS uses the default preset, // most plugins are available ... Define the component using these styles and pass it the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can probably write a custom Stylis plugin for that if there is not one already. Though, likely more trouble than it’s worth.
It is undocumented at the moment.
After this wrap your App at whatever level you need (top-level or only a portion)
Here’s the source if you are curious. https://github.com/emotion-js/emotion/blob/ab535a8c7a0dcbbb6af310634eb3cee4bc2f8e2c/packages/cache/src/index.js#L94