Skip to content

Enhance TextField to support children#789

Closed
chrismcv wants to merge 3 commits intomui:masterfrom
chrismcv:master
Closed

Enhance TextField to support children#789
chrismcv wants to merge 3 commits intomui:masterfrom
chrismcv:master

Conversation

@chrismcv
Copy link
Contributor

@chrismcv chrismcv commented Jun 8, 2015

One of my use cases needs to extend TextField to support optional children fields. For example, we have a "star" input control, that lets users highlight a preferred phone number.

    <TextField floatingLabelText={@props.label}>
      <StarInput ref="sel" 
          {...props}
          onChange={@props.onChange} 
          onStarChange={@props.onStarChange} 
          />
    </TextField>

image

I've implemented this in the attached PR assume the child component behaves in the same way as a vanilla input. This has slotted into my project with minimal hassle. It'd be great if this could be merged.

@hai-cea
Copy link
Member

hai-cea commented Jun 9, 2015

Also, instead of replacing out the input element, it might be cleaner to just render any children inside the containing div. That way you can just style the star and we're not changing how the input works.

What do you think?

@chrismcv
Copy link
Contributor Author

chrismcv commented Jun 9, 2015

I'll have a look into the warning tomorrow morning.

The only advantage of replacing the input might be in making the dropdown menu consistent with TextField, so in effect the TextField becomes a wrapper for most input type fields. For my "star" use case, rendering the children wouldn't be an issue. I also plan to have a numeric spinner and editor using the same style/api, but these could probably use the input in TextField rather than replacing it.

@hai-cea
Copy link
Member

hai-cea commented Jun 15, 2015

Does #846 replace this?

@chrismcv
Copy link
Contributor Author

yes

@chrismcv chrismcv closed this Jun 15, 2015
@zannager zannager added the scope: text field Changes related to the text field. label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: text field Changes related to the text field.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants