简体   繁体   中英

Change the clock svg to another svg in Material UI X Timepicker

I am using the Material UI x time-picker component in my app. I would like to change the clock SVG in the component to a custom SVG (a Chevron). I read that I need to use the props components. But what is the component called? I tried with the testid ClockIcon but that was not successful.

I believe what you are looking for is this:

<TimePicker
    label="Time"
    value={value}
    onChange={handleChange}
    renderInput={(params) => <TextField {...params} />}
    components={{
      OpenPickerIcon: SearchIcon //  Replace with your icon 
    }}
  />

For example I have imported the SearchIcon to use it as an example to replace the default one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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