I am trying to limit the maxlength of text type input field to specific number but it's not working.
Here is what I am trying
<TextField
InputProps={{ placeholder: '#'}}
type='text'
value = { _some state_ }
onChange = { _someFunction_ }) }
maxLength = "1"
/>
The maxLength
property isn't forwarded to the input element. You can use the inputProps
property for that.
Is there a reason why TextField can't have the maxLength prop and forward it to the input component? @oliviertassinari
@albinekb There is an endless list of property to forward. TextField
is a simple API sugar. The abstraction is meant to leak.
Ok 馃憤 thanks for clarifying. I think this should be written in the docs too! (just to make it clear)
@albinekb Good idea, on it 馃憤
BTW: Are you guys chatting somewhere in some Slack where I can join? I would like to start contributing to this project (as I'm using & enjoying it more and more every day 鉂わ笍 )
or do you have any straight up issues you want me to attempt a PR on? 馃檶
@oliviertassinari
@albinekb You can reach us on gitter :). I have been keeping a list of issues with a good first issue
tag. Depends on how much you are aware of the internals of the project, this is a good starting point.
Most helpful comment
The
maxLength
property isn't forwarded to the input element. You can use theinputProps
property for that.