简体   繁体   English

如何为版本 5 自定义材质 UI 日期选择器图标?

[英]how to customize material UI date-Picker icon for version 5?

As I am Using Date picker of material UI version 5,I trying to replace Icon with my customized (image or svg) but not able to do so.当我使用材料 UI 版本 5 的日期选择器时,我尝试用我的自定义(图像或 svg)替换 Icon 但无法这样做。 please help:-请帮忙:-

i found some result for this for changing icon but not able to apply over customized one我发现了一些更改图标的结果,但无法应用自定义图标

How to change the icon in MUI DatePicker? 如何更改 MUI DatePicker 中的图标?

components={{
                  OpenPickerIcon: ?
                }}

Its only applying icon which are available on material UI but required some other image or svg there.它唯一的应用图标在材料 UI 上可用,但需要一些其他图像或 svg。

this link image contain icon which required change [1]: https://i.stack.imgur.com/wVXvz.png此链接图像包含需要更改的图标 [1]: https://i.stack.imgur.com/wVXvz.png

Any help will be appreciated and Thankful.任何帮助将不胜感激和感激。

You need to wrap your image in a custom icon component.您需要将图像包装在自定义图标组件中。 See details on custom icons here .此处查看自定义图标的详细信息。

For instance:例如:

function DateIcon(props) {
  return (
    <SvgIcon {...props}>
      <path d="{your svg path}" />
    </SvgIcon>
  );
}

And then:接着:

components={{
  OpenPickerIcon: DateIcon
}}

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

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