Comments (5)
Looks like using
selected
might lead others down the same confusion lane when they're styling the selected day.
Thank you for paying attention to this point. I agree that putting all the available classes in the list of styleOverrides
is not ideal, because some of them will not work and produce a console error. 🙈
We'll investigate how this can be improved. 😉
But here's the scoop: the style only pops up when users click the date picker, as mentioned in the issue. :/
The issue is that you are styling the selected day, but there are additional styles for the focus
state that you'd need to change. 🤔
mui-x/packages/x-date-pickers/src/PickersDay/PickersDay.tsx
Lines 149 to 157 in bc93847
from mui-x.
@LukasTy I will add this to the board toi investigate the class issue.
from mui-x.
Hello @bernbecht, if you check the console, there is an error message there regarding the specificity issue and how to resolve it:
Could you please try applying the following diff and see if that helps? 🤔
-selected: {
- backgroundColor: "green",
-},
+root: {
+ "&.Mui-selected": {
+ backgroundColor: "green",
+ },
+},
P.S. Have you had the chance to check the customization playground in the docs?
from mui-x.
Hey @LukasTy, thanks for getting back to me! 👋
I gave your diff a shot, and now I can tweak the selected day with createTheme()
✨ Your heads up about the console was great!
But here's the scoop: the style only pops up when users click the date picker, as mentioned in the issue. :/
I leaned towards using the selected
property in createTheme()
because TypeScript nudged me with it as an option for MuiPickersDay
styleOverrides
. Peeking at interface PickersDayClasses
, here's what I found:
// Snippet from @mui/x-date-pickers/PickersDay/pickersDayClasses.d.ts
export interface PickersDayClasses {
/** Styles applied to the root element. */
root: string;
...
/** State class applied to the root element if `selected=true`. */
selected: string;
...
}
Looks like using selected
might lead others down the same confusion lane when they're styling the selected day.
P.S. Did you get a chance to peek at the customization playground in the docs?
Yep, already scoped it out! 🕵️♂️ Got a good grip on how to tweak those pickers. Cheers! 😄
from mui-x.
A part from the class issue, the styling is clear now :) Thank you
from mui-x.
Related Issues (20)
- [data grid] infinite loop occurs under certain circumstances HOT 10
- New component Barcode & QRCode & scanner HOT 1
- [pickers] DateBuilderReturnType provides wrong type with no arg HOT 3
- [data grid] Add support for async valueOptions callback HOT 1
- [pickers][DateTimePicker] page scrolls when mouse is moved outside of it when using hour/minute picker HOT 5
- [docs] Tree View: check children, uncheck parents HOT 3
- [data grid] Column resizing doesn't work from group HOT 1
- [pickers][Datepicker][AdapterDateFnsV3] unable to set single digit day of month format HOT 4
- [charts] LineChart doesn't draw graph on page load HOT 1
- [charts][LineChart] unwanted horizontal line when rendering 100 data points HOT 7
- [data grid] Improve localization dx for custom filters
- [tree view][RichTreeView] Custom styling not working HOT 8
- [data grid] Support edit functionality with server-side data source
- [data grid] Add height property, analog to Chart HOT 1
- [data grid] Upgrade v6 => v7 breaks existing styles applied HOT 2
- [data grid] GridHeaderCheckbox.js failed to compile x-data-grid after upgrading to v7 HOT 3
- [data grid] Replace ExcelJS HOT 2
- [data grid] adding a new row with the autoHeight prop causes first row flicker. HOT 3
- [data grid] The `column groups` do not appear in the data grid of my Next.js application HOT 3
- [charts] Missing documentation about how to add tooltip with composition HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.