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

219
Visualizações
Material Dashboard React select input does not show the arrow icon

Code View

Is there any reason to view the select like this. Arrow icon not visible. I'm using the "@mui/material": "^5.8.6". Please help me on this

<Box sx={{ width: "auto" }}>
    <FormControl fullWidth>
        <TextField
            select
            labelId="demo-simple-select-label"
            id="demo-simple-select"
            value={gender}
            label="Gender"
            onChange={(e) => setGender(e.target.value)}
        >
            <MenuItem value="Male">Male</MenuItem>
            <MenuItem value="Female">Female</MenuItem>
        </TextField>
    </FormControl>
</Box>                      
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It seems Material Dashboard 2 React does not support a select input by looking into their docs.

But under the hood, they use TextField from @mui/material along with @mui/material/styles and TextField can be a select input. See the code in MDInputRoot.js.

  1. Replace your code for select input with the following theme native component except the MenuItem which has to be imported from @mui/material:
<MDBox mb={2}>
  <MDInput
    size="large"
    select
    labelId="demo-simple-select-label"
    id="demo-simple-select"
    //value={gender}
    label="Gender"
    InputProps={{
      classes: { root: "select-input-styles" },
    }}
    fullWidth
  >
    <MenuItem value="Male">Male</MenuItem>
    <MenuItem value="Female">Female</MenuItem>
  </MDInput>
</MDBox>

We have set a new root-level CSS class for the input element by providing class using the InputProps.

  1. Then create a new CSS file named inputCustomStyles.css inside src/components/MDInput directory.
.select-input-styles {
    padding: 12px 0;
}

.select-input-styles svg {
    display: block;
    width: 2em;
    height: 2em;
    top: calc(50% - 1em);
}

padding has been changed to fix the input height issue you have got and svg display set to block to make a arrow visible.

  1. Now import the styles in the top of MDRootInput.js file:
...
...
import "./inputCustomStyles.css";

I have checked the changes in the src/layouts/authentication/sign-in/index.js file and it look like below:

about 4 years ago · Juan Pablo Isaza 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