简体   繁体   English

如何更改 MUI DatePicker 中的图标?

[英]How to change the icon in MUI DatePicker?

I can't add my icon to the component.我无法将我的图标添加到组件中。

https://codesandbox.io/s/materialuipickers-material-demo-forked-soctc https://codesandbox.io/s/materialuipickers-material-demo-forked-soctc

在此处输入图片说明

The components prop of DatePicker lets you override the inner components including the OpenPickerIcon , so this is how you override it.components的道具DatePicker让您可以覆盖内部组件,包括OpenPickerIcon ,所以这是你如何将其覆盖。 For reference, see the full API of DatePicker here :作为参考,请在此处查看DatePicker的完整 API:

import AccessibleIcon from "@mui/icons-material/Accessible";
<DatePicker
  components={{
    OpenPickerIcon: AccessibleIcon
  }}
  {...}

This is the list of icon components that can be customized:这是可以自定义的图标组件列表:

{
  LeftArrowIcon?: elementType,
  OpenPickerIcon?: elementType,
  RightArrowIcon?: elementType,
  SwitchViewIcon?: elementType
}

在此处输入图片说明

代码沙盒演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM