Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

222
Vistas
MUI Input doesn't allow oninput attribute

I have an MUI Input component defined like this where the oninput (tried as onInput as well) attribute doesn't get picked by MUI

  <Input
    variant="standard"
    size="small"
    type="number"
    inputProps={{
      min: '0',
      oninput: "validity.valid||(value='');",
    }}
    onChange="validity.valid||(value='');"
  />

As the MUI doc says,

inputProps object {} Attributes applied to the input element.

And well, oninput is a valid Event attribute for the input element but on render, the underlying native HTML input element has only the min attribute defined and the oninput attribute is missing.

What is going wrong here? I even tried it with onChange but to no success.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should pass a function parameter as onInput prop instead of a string like this:

const handleOnInput = (e) => {
    //e.target.value
};

<Input
    value={val}
    variant="standard"
    size="small"
    type="number"
    inputProps={{
      min: "0",
      onInput: handleOnInput
    }}
/>

You can take a look at this sandbox for live working example.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda