Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`DatePickerInput` "className" property for `<input />`

I'm using the DatePickerInput react component and want to style the <input /> element inside. With the component's className property I can only style the <div /> container around. Using classNames object property also styles other containers.

So is it possible and if it is, how, to apply a CSS class directly to the <input /> element (I'm using Bootstrap so I want to add the class "form-control" for consistency)?

like image 293
shaedrich Avatar asked May 22 '26 16:05

shaedrich


1 Answers

Use the inputProps prop to pass a className prop explicitly to the input. This prop should be an object with key/value pairs corresponding to the props for the input:

<DayPickerInput inputProps={{ className: 'form-control' }} … />
like image 114
Andrew Li Avatar answered May 25 '26 05:05

Andrew Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!