Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxlength attribute is not working in v1 #7768

Closed
paliwalgaurav opened this issue Aug 15, 2017 · 8 comments
Closed

maxlength attribute is not working in v1 #7768

paliwalgaurav opened this issue Aug 15, 2017 · 8 comments
Labels
component: text field This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@paliwalgaurav
Copy link

paliwalgaurav commented Aug 15, 2017

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"
/>

Versions

  • Material-UI: 1.0.0-beta.3
  • React: 15.6.1
  • Browser: chrome
@oliviertassinari
Copy link
Member

The maxLength property isn't forwarded to the input element. You can use the inputProps property for that.

@oliviertassinari oliviertassinari added component: text field This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement v1 labels Aug 15, 2017
@albinekb
Copy link
Contributor

Is there a reason why TextField can't have the maxLength prop and forward it to the input component? @oliviertassinari

@oliviertassinari
Copy link
Member

@albinekb There is an endless list of property to forward. TextField is a simple API sugar. The abstraction is meant to leak.

@albinekb
Copy link
Contributor

Ok 👍 thanks for clarifying. I think this should be written in the docs too! (just to make it clear)

@oliviertassinari
Copy link
Member

@albinekb Good idea, on it 👍

@albinekb
Copy link
Contributor

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

@oliviertassinari
Copy link
Member

@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.

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed support: question Community support but can be turned into an improvement labels Jul 28, 2021
@oliviertassinari
Copy link
Member

Duplicate of #1578

@oliviertassinari oliviertassinari marked this as a duplicate of #1578 Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants