Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda