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

Usage with bs-css #127

Closed
amiralies opened this issue May 22, 2021 · 4 comments
Closed

Usage with bs-css #127

amiralies opened this issue May 22, 2021 · 4 comments

Comments

@amiralies
Copy link

Is it possible to use mui with bs-css? I tried to use bs-css's style function output as className for components but it seems this doesn't work well. it seems they are applied before materual ui classes so they got overriden by material ui classes

@fhammerschmidt
Copy link
Member

fhammerschmidt commented May 26, 2021

Yes. You need to use the StylesProvider, which there is no binding for yet, unfortunately.

Example:

module Styles = {
  open CssJs

  let categoryButton = style(.[textTransform(#none), justifyContent(#flexStart)])
  let icon = style(.[fontSize(px(24)), width(px(50))])
}

@react.component
let make = () => {
  open MaterialUi

  <Mui_StylesProvider injectFirst=true>
    <Button
      color=#Primary classes={Button.Classes.make(~root=Styles.categoryButton, ())} onClick=ignore>
      {React.string("Hello, BS-CSS & MUI!")}
    </Button>
  </Mui_StylesProvider>
}

Watch the button text become uppercase when you change the injectFirst property to false.

I made an example project which includes the binding.

We will include the binding to the StylesProvider in the upcoming version.

@amiralies
Copy link
Author

Thank you!
I think bs-css-dom should also work right?

@fhammerschmidt
Copy link
Member

I only used it with emotion myself. But the problem is just that JSS styles get applied after user styles as you said, so this solution probably works for all of them.

@cknitt
Copy link
Member

cknitt commented May 29, 2021

StyleProvider is now included in version 2.1.0.

@cknitt cknitt closed this as completed May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants