question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't customize DatePicker calendar background-color

See original GitHub issue

I’m using DatePicker widget(from ‘carbon-components-react’ Carbon X), and I see the calendar part background-color doesn’t match with the page background(The page background is white, and the DatePicker is in this page, its background-color shall be grey to have a contrast with the page background color to follow carbon style), while I find calendar css doesn’t belong to my css layers, and it is in global part, so I can’t change its background-color only in my page. p1

I tried to set className for the DatePicker in my js, and then set :global .bx–date-picker__calendar { background-color: #f4f4f4; } in corresponding less file under the className, however, it doesn’t work. If I change the calendar’s background-color directly in global part, it will take effect for all DatePickers calendar used in the product, while in other pages, the background-color for that page’s DatePicker calendar may not always be grey the same in my current page. Could someone help to let me know how to resolve it? Or is it a bug for DatePicker widget? Thanks.

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Detailed description

Describe in detail the issue you’re having.

Is this issue related to a specific component?

What did you expect to happen? What happened instead? What would you like to see changed?

What browser are you working in?

What version of the Carbon Design System are you using?

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

Steps to reproduce the issue

  1. Step one
  2. Step two
  3. Step three
  4. etc.

Please create a reduced test case in CodeSandbox

Additional information

  • Screenshots or code
  • Notes

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AngelaChenBJcommented, Apr 10, 2020

It resolves my problem. Thanks a lot! @jakubfaliszewski

1reaction
jakubfaliszewskicommented, Apr 10, 2020

static is the default value of positon for most of elements. Just add position: relative style to the element your’e appeding DatePicker. For example:

JS

appendTo={document.getElementById("root")}

CSS

#root { position: relative; }

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change background color of datePicker? - css
For example, I want to change the green color to blue? datepicker image. (for information, I can't use JS). How to add a...
Read more >
Change the color of date picker. - ServiceNow Community
Solved: Hi, Need to know, where to change this date picker and calendar ... This will update the background color of the selected...
Read more >
UIDatePicker iOS 14 compact remove default background
I want to change background color of UIDatePickerView, mode is compact. If I set white color then it does not reflect, but if...
Read more >
Calendar style issue - OutSystems
Hi,. Is it possible to change this blue color. This is input widget, Data Type is Date Time. And I can able to...
Read more >
How do I control the colors of DatePicker field in CSS? - Jotform
Please find the above element in the inject CSS code and change the background color as you needed. Thanks! Profile Image. zoiglobal. Answered ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found