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

290
Visualizações
i want to add both type and maxLength to mui textfield
<TextField
                      value={ele.mobile}
                      helperText={ferrors[id]?.mobile}
                      name="mobile"
                      classes={{ root: classes.textField }}
                      InputProps={{ className: classes.textField }}
                      inputProps={{ maxLength: 10, type:'number'}}
                      label="Mobile Number"
                      variant="outlined"
                      onChange={(e) => handleChange(id, e)}
                    />

I have given the values form inputProps of maxLenght and type but only type is working

about 4 years ago · Santiago Gelvez
3 Respostas
Responde à pergunta

0

if you want to make number of lenght max 10, just use max with largest number:

inputProps={{ max: 9999999999, type:'number'}}
about 4 years ago · Santiago Gelvez Relatório

0

maybe this will help
 <TextField
 required
 id="required"
 label="Required"
 min={0}
 inputProps={{
    maxLength: 5,
    type: 'number',
}}
onInput={(e)=>{
    e.target.value = Math.max(0, parseInt(e.target.value) ).toString().slice(0,e.target.maxLength)
}}
/>

about 4 years ago · Santiago Gelvez Relatório

0

About your question, I think you can try to use maxlength setting in inputProps.

<TextField
                      value={ele.mobile}
                      helperText={ferrors[id]?.mobile}
                      name="mobile"
                      classes={{ root: classes.textField }}
                      InputProps={{ className: classes.textField }}
                      inputProps ={{ maxlength: 10, type:'number'}}
                      label="Mobile Number"
                      variant="outlined"
                      onChange={(e) => handleChange(id, e)}
                    />

about 4 years ago · Santiago Gelvez 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