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

Customise input field #45

Closed
timothyarmes opened this issue Dec 16, 2015 · 7 comments
Closed

Customise input field #45

timothyarmes opened this issue Dec 16, 2015 · 7 comments

Comments

@timothyarmes
Copy link

Hi,

It would be great if we could add children to the input element. That would allow us to add icons. For example, using Semantic UI I'd like to produce output like this:

<div class="ui left icon input">
  <i class="calendar icon"></i>
  <input type="text" placeholder="Enter tags">
</div>

I tried this:

<div className='ui left icon input'>
   <i className='calendar icon' />
   <DateTime
      timeFormat={false}
      isValidDate={this.validFromToday}
      inputProps={{ placeholder: T('datePlaceholder')}}
      onChange={(value) => this.handleChange('startDate', value)} />
</div>

But that doesn't work since you're wrapping the input.

@arqex
Copy link
Owner

arqex commented Dec 16, 2015

This is a hard request. I can't open the markup of the component to be editable completely. But maybe you can update your css to place the icon in the right position. Replacing the input clas by a datepicker one:

<div className='ui left icon datepicker'>
   <i className='calendar icon' />
   <DateTime
      timeFormat={false}
      isValidDate={this.validFromToday}
      inputProps={{ placeholder: T('datePlaceholder')}}
      onChange={(value) => this.handleChange('startDate', value)} />
</div>

Maybe you can position the i element absolutely over the datepicker input.

@timothyarmes
Copy link
Author

That would be really awkward.

How about if you could however accept a 'prefix' and 'postfix' property that would insert components either side of the input....

@aseem2625
Copy link

Is there anyway I can pass a prop which acts placeholder for the input?

@timothyarmes
Copy link
Author

inputProps={{ placeholder: 'blah')}}

@aseem2625
Copy link

@timothyarmes Thanks :) Worked.

@hiepndd
Copy link

hiepndd commented Dec 4, 2018

Hi @arqex!
In react-datetime. How can I allow user only input number and slash symbol when they can manual input date instead of select from calendar.
Sorry for any inconvenience.
Thanks in advance.

@ron766
Copy link

ron766 commented Apr 3, 2020

inputProps={{ placeholder: 'blah')}}

this is not working for me

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

5 participants