question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TextField] InputProps vs inputProps confusion

See original GitHub issue

The TextField (nor Input) does not pass the step property through to the input as a step attribute.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

<Textfield type="number" step="0.01" /> renders a <input type="number" step="0.01" />

Current Behavior

<Textfield type="number" step="0.01" /> renders a <input type="number" />

Steps to Reproduce (for bugs)

  1. Go to https://codesandbox.io/s/lyxw254vz9
  2. Click on the up/down arrows on right of textbox and see differences in behaviour

Context

Your Environment

Tech Version
Material-UI 1.0.0.rc0
React 16
browser Safari - Not possible to insert 0.xx number and pass validation. Chrome accepts 0.xx number and validates it but step is still by unit

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:27
  • Comments:23 (18 by maintainers)

github_iconTop GitHub Comments

6reactions
sakulstracommented, May 14, 2018

didn’t test, but I guess you should use <TextField inputProps={{step: 0.01}} /> instead? It#s a prop on Input instead of TextField.

update: sry, just checked your sandbox 😄 you already came up with that. What#s the problem with the inputProps solution? I guess there are more props we don’t pass down automagically: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement so it might be consistent to not do it at all.

4reactions
oliviertassinaricommented, Jun 17, 2022

@mnajdova I’m not sure what the right terminology is. From my perspective, props are first applied to the element, then made available in the component’s render method.

At this point, I would either propose:

  1. A better documentation https://github.com/mui-org/material-ui/issues/11377#issuecomment-812101655
Capture d’écran 2021-06-25 à 15 59 59
  1. Renaming inputhtmlInput to match the htmlFor (React), htmlColor (Icon component) props convention.

We can likely do these two changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

inputProps vs InputProps in MUI TextField - reactjs
InputProps applies to Input react-component since: TextField is composed of smaller components ( FormControl, Input, FilledInput, ...
Read more >
TextField API - Material UI
Name Type Default autoComplete string autoFocus bool false classes object
Read more >
inputProps vs InputProps
inputProps vs InputProps ... TextField.js. index.js ... VS Code's tsserver was deleted by another application such as a misbehaving virus detection tool.
Read more >
تويتر \ التغريدات مع الردود بواسطة Material UI (MaterialUI@)
[TextField] InputProps vs inputProps confusion · Issue #11377 · mui/material-ui. The TextField (nor Input) does not pass the step property through to the ......
Read more >
ng-content vs Input props : r/Angular2
I use both of these methods when building components for my libraries. I'm a bit confused on your intended use as I don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found