Search code examples
reactjsantd

Proper way to hide calendar icon (suffix icon) in DatePicker for AntD


This is the way I am hiding the calender icon in the DatePicker component for antD React. It feels hacky, is it the only way?

Attribute:

suffixIcon={<div></div>} 

Full Component:

<DatePicker 
  bordered={false} 
  format="MMM Do, YYYY" 
  defaultValue={new moment()} 
  allowClear={false} 
  suffixIcon={<div></div>} 
/>

Solution

  • Try pass null to attribute

    suffixIcon={null}
    

    component props example:

    <DatePicker
     suffixIcon={null} 
     bordered={false} 
     format="MMM Do, YYYY" 
     defaultValue={new moment()} 
     allowClear={false} 
    />