How can I set a custom placeholder element?
I'd like to add a search icon when the field is empty
Thanks.
TLDR; I just figured out that I can just simply pass a component
I guess I did not get that a node could be a component.
The documentation indicates:
placeholder - type: string|node
The following line comes from the source. As you see, it allows a component to be passed.
return !this.state.inputValue ? <div className="Select-placeholder">{this.props.placeholder}</div> : null;
So I can use
<Select placeholder={<div>Type to search</div>} />
<Select placeholder={Type to search} />
works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With