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

280
Views
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 answers
Answer question

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 Report

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 Report

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 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!