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

Refs on inputs #55

Open
tomitrescak opened this issue Apr 23, 2016 · 3 comments
Open

Refs on inputs #55

tomitrescak opened this issue Apr 23, 2016 · 3 comments

Comments

@tomitrescak
Copy link

Thanks for this wonderful package. I have a question concerning handling of refs on form elements. How can I approach this? I need a value from the input control. Thanks!

@jessy1092
Copy link
Owner

Use react ref to reference your <input /> element?
ex.
https://facebook.github.io/react/docs/more-about-refs.html#the-ref-string-attribute

@tomitrescak
Copy link
Author

Hmm, that much I know ... since I'm talking about wanting to use refs ;) The problem is that you render input INSIDE your Input control, therefore the ref belongs to the Input control, not the parent containing control. So I simply cannot access the ref'd component.

@jessy1092
Copy link
Owner

@tomitrescak OK, I see. Sorry, I misunderstand. You could add custom <input /> element as the <Input />'s children and it would render custom <input /> inside. :) Then you could add ref by yourself.

like:

<Input>
 <input placeholder="Search..." type="text" />
</Input>

It would become

<div class="ui input">
  <input placeholder="Search..." type="text" />
</div>

PS. If you do this, placeholder and type would be not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants