Remove "bg-light" css class from the datepicker component
See original GitHub issueVersions of Angular, ng-bootstrap and Bootstrap:
Angular: 7.2.2
ng-bootstrap: 4.1.0
Bootstrap: 4.2.1
I think hard coding bg-light
into the datepicker makes it difficult to customize it’s theme, especially a dark theme.
Most often I’ve had to override every css class attached to the datepicker, adding !important
which doesn’t feel right.
Can we remove the bg-light
class and let this be handled by the dropdown-menu
class, allowing the user to override that.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Remove background arrow from date input in Google Chrome ...
As per Jeremy's answer, it is now possible to remove the arrow and spin buttons. ... <input type="date" id="dateInput" class="unstyled" /> dateInput.
Read more >Datepickers - Lightning Design System
On the element with the class slds-combobox , please remove role="combobox" , aria-expanded , and aria-haspopup . On the input that we just...
Read more >Form Datepicker | Components - BootstrapVue
BootstrapVue custom date picker input form control, which provides full ... Want a fancy popup with a dark background instead of a light...
Read more >CSS code: Remove form border and change date picker ...
CSS code: Remove form border and change date picker background · Click on the Paint Roller icon · Select Styles · Scroll down...
Read more >Tailwind CSS Datepicker - Flowbite
The Tailwind CSS datepicker component developed by Flowbite is built with vanilla ... <input datepicker type="text" class="bg-gray-50 border border-gray-300 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @casoetan ! Thanks to report this evolution.
We could for sure, and we will have to, remove the usage of this
.bg-light
Bootstrap class. Nonetheless we just can’t rely on.dropdown-menu
. Our datepicker can also be opened inline, as a simple calendar, and thus won’t be wrapped by a dropdown!I think we just need to move all these values to our
.ngb-datepicker
classes (and children classes also)The !important was just a stop-gap until .bg-light was removed, I did see there is a PR which fixes this issue.
In my mind, if you wanted to add themes you’d do it on the base element (ngb-datepicker class=“bg-light” or “bg-dark”) and that would affect nested content by overriding certain styling properties like color and background-color, border, hover effects etc. I’ve only just started working with the component, but you could set nested content to inherit properties from the main component container.
For instance, if you originally had
ngb-datepicker ngb-dp-header.bg-light { color:#333; background-color:#f8f8f8; } and
ngb-datepicker ngb-dp-header.bg-dark { color:#eee; background-color:#333; }
you could instead do the following:
ngb-datepicker.bg-light { color:#333; background-color:#f8f8f8; } and
ngb-datepicker.bg-dark { color:#eee; background-color:#333; }
coupled with:
ngb-datepicker ngb-dp-header, ngb-datepicker ngb-dp-month-name { color:inherit; background-color:inherit; }
to more easily theme your component.
Also, while it is nice that you use common class names like .btn and .dropdown-menu in some areas, these do get overwritten if they are being used elsewhere in someone’s site. I’ve had to create some extra classes to ensure these don’t get overridden in the datepicker (wasn’t really any trouble though).
On Tue, Jun 25, 2019 at 6:44 AM IAfanasov notifications@github.com wrote: