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

[TextField] Add inputProps back #9604

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Dec 22, 2017

Revert #9382 cc @rosskevin

As suggested by @kgregory how have been dealing with this recurring question on the discussion channels: #9575 (comment)

Providing extra properties to the native input is one of the top actions people are doing with the TextField component. We should make it as easy as possible.

@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label Dec 22, 2017
Copy link
Member

@kgregory kgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve, but think we should go further and eliminate all other props that pass through to the input element. Maybe another PR?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Dec 22, 2017

eliminate all other props that pass through to the input element

@kgregory Oh, you mean the name, value etc? Well, my understanding of the situation is that you will at have a:

  • > 80% chance to use the bind properties (name, value, type, etc.)
  • > 60% chance to need the inputProps property
  • > 40% chance to need the XXXProps properties
  • > 20% chance to have to use the lower level components

The less generic your use case is, the more painful it is to implement. It's all about the right tool for the right job.

@kgregory
Copy link
Member

I was thinking of eliminating props that exist only so they can be passed to input, like autoComplete and autoFocus at this level, leaving them to InputProps (or inputProps if we eliminate them from Input as well). Props like name, value, and disabled make sense to keep.

@oliviertassinari
Copy link
Member Author

@kgregory I have been adding those as people were requesting them. What sure is that we shouldn't add more. Now, regarding removing some. I have no certainty, maybe.
Personally, my strategy would be more: I would rather focus on other topics.
It's not like we have a lot right now:

    <Input
      autoComplete={autoComplete}
      autoFocus={autoFocus}
      defaultValue={defaultValue}
      disabled={disabled}
      multiline={multiline}
      name={name}
      rows={rows}
      rowsMax={rowsMax}
      type={type}
      value={value}
      id={id}
      inputRef={inputRef}
      onChange={onChange}
      placeholder={placeholder}
      {...InputProps}
    />

@kgregory
Copy link
Member

@oliviertassinari that’s fine, I just felt as though supporting some input attributes would cause confusion. For example, autoFocus is supported, min and max are not. Maybe this can be handled in documentation. We draw a line at the attributes we’ve supported and push people toward inputProps for all others.

@oliviertassinari oliviertassinari merged commit 1c04c3c into mui:v1-beta Dec 24, 2017
@oliviertassinari oliviertassinari deleted the text-field-add-inputProps-back branch December 24, 2017 09:24
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!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants