Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
Material UI disable browser specific CSS rules --webkit- etc

I would like to disable all of the browser rules that are exported when MUI is compiledenter image description here:

So I would like to see:

{
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: flex-start;
    -webkit-box-align: flex-start;
    -ms-flex-align: flex-start;
    align-items: flex-start;
}

This

{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

I cannot see a way to do this with MUI4 or MUI5.

Component

import React from 'react'
import { styled } from '@mui/material'
    
const ChildContainer = styled('div')`
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
`

export const TopNav: React.FC = ({ children, ...props }) => {
  return (
      <ChildContainer data-name="ChildContainer">{children}</ChildContainer>
  )
}

export default TopNav
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can control this using Emotion's CacheProvider component by providing it with a cache that does not leverage the prefixer stylis plugin. Below is a working example that allows you to toggle back and forth between including the vendor prefixes or not.

import React from "react";
import { CacheProvider } from "@emotion/react";
import createCache from "@emotion/cache";
import { styled } from "@mui/material/styles";
import Button from "@mui/material/Button";
import { prefixer } from "stylis";

const StyledDiv = styled("div")`
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
`;
const cacheNoPrefixer = createCache({
  key: "noprefixer",
  stylisPlugins: []
});
const cacheWithPrefixer = createCache({
  key: "prefixer",
  stylisPlugins: [prefixer]
});

export default function App() {
  const [includePrefixer, setIncludePrefixer] = React.useState(false);
  return (
    <CacheProvider
      value={includePrefixer ? cacheWithPrefixer : cacheNoPrefixer}
    >
      <StyledDiv>
        Including Prefixing: {JSON.stringify(includePrefixer)}
        <Button onClick={() => setIncludePrefixer(!includePrefixer)}>
          Toggle Prefixing
        </Button>
      </StyledDiv>
    </CacheProvider>
  );
}

Edit no vendor-prefixing

Related answers:

  • How to disable prefixes in Emotion 11 in development?
  • Material-Ui TextField not affected with the RTL direction (a different usage of CacheProvider)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!