Home > Enterprise >  Typescript does not recognize ant design prop for rendering icon
Typescript does not recognize ant design prop for rendering icon

Time:05-10

I am new in typescript and Ant design. I have a password input and want to have an open/invisible Icon inside input element. But typescript gives me an error, iconRender does not exist on type 'IntrinsicAttributes & InputProps & RefAttributes'. How could I fix it?

<Input
 type="password"
 className={styles["password-input"]}
 placeholder="Password"
 iconRender={(visible: ReactNode) =>
  visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />
 }
/>

CodePudding user response:

You should use Input.Password for password input from antd. See more: https://ant.design/components/input/#components-input-demo-password-input

  • Related