Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use WithStyles in runtime (instead of just as an HOC) -- allow for dynamic styles #13641

Closed
2 tasks done
buob opened this issue Nov 19, 2018 · 2 comments
Closed
2 tasks done

Comments

@buob
Copy link

buob commented Nov 19, 2018

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I'm not exactly sure how the contract would be, but I would like to use WithStyles in runtime, so I can modify the styles that I pass to it in runtime.

<WithStyles styles={someDynamicJSS}>
  <div />
</WithStyles>

Current Behavior

(I believe) I can only call the HOC, locking in the styles that are passed at build time.

withStyles(staticStyles)(MyComponent)

Examples

I'm assuming it wouldn't be quite as simple as exporting the WithStyles class, assuming it's not exported right now gives me the impression it's not possible as a feature today.

Context

We are building a system that allows users to create pages, and they can select "stylesheets" of sorts that are different collections of JSS so they can dynamically change the look of the page. They will eventually be able to provide their own JSS.

@oliviertassinari
Copy link
Member

@buob You are going to like this API: https://next.material-ui.com/css-in-js/basics/#adapting-hook-api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants