我正在使用material UI中的DatePicker
组件.我想访问年度挑选器部分的sxprops ,但我不知道如何访问.
我try 了什么:
我试着使用slotProps
和sx
props 访问年度挑选器部分的sxprops ,但我没有成功.
预期结果:
我希望能够访问sx
年 Select 器部分的props ,以改变在图像中出现的蓝色背景上所选年份的 colored颜色 .
代码:
<DatePicker
defaultValue={dayjs().subtract(1, "month")}
label="Tarih Başlangıcı"
onChange={(e: dayjs.Dayjs | null) =>
setDateStart(e?.format("DD.MM.YYYY"))
}
slotProps={{
day: {
sx: {
"&.MuiPickersDay-dayWithMargin.Mui-selected": {
bgcolor: "var(--c1)",
},
},
},
}}
sx={{
".MuiInputBase-root": {
borderRadius: 25,
},
".MuiButtonBase-root": {
color: "var(--c1)",
},
".Mui-focused": {
".MuiOutlinedInput-notchedOutline": { borderColor: "var(--c1)" },
"&.MuiInputLabel-formControl": { color: "var(--c1)" },
},
}}
/>