Though this is a duplicate question none of the previous answers could help me change the color of the datepicker's placeholder. The other styles are being applied other than the placeholder
's color. How to implement this?
.ant-picker-input input::placeholder {
font-style: italic;
text-align: end;
color:red;
opacity: 1;
}
The above image is the borderless, iconless datepicker that I have used.
<Space direction="vertical" size={12} className="grid-cols-1">
<DatePicker
format="YYYY-MM-DD HH:mm:ss"
disabledDate={disabledDate}
disabledTime={disabledDateTime}
placeholder="Schedule a Meet"
showTime={{ defaultValue: dayjs("00:00:00", "HH:mm:ss") }}
suffixIcon={null}
/>
<Upload {...props}>
<Button icon={<UploadOutlined />}>Click to Upload</Button>
</Upload>
</Space>
If i use !important
, it will change the color of placeholder.
.ant-picker-input > input::placeholder {
color: red !important;}
You can wrap your Datepicker with div
and with help of less/scss
you can update placeholder code.
<>
<div className="wrapper">
<DatePicker onChange={onChange} />
</div>
<DatePicker onChange={onChange} />
</>
// scss
.wrapper {
.ant-picker-input > input::placeholder {
color: red;
}
}
If you not able to find any answer you can try this.