Skip to content

ListItem doesn't accept prop htmlFor (TypeScript) #12486

Closed
@pixelkritzel

Description

@pixelkritzel

This is a Typescript error

The ListItem component accepts label for the prop component but doesn't accept the htmlFor prop as it should

  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

If I provide a value of label to the prop component of the ListItem component I should also be able to provide the prop htmlFor

So

<ListItem component="label" htmlFor="foo" />

should crate this HTML

<label for="foo />

Current Behavior

Instead I get the type error

Property 'htmlFor' does not exist on type 'IntrinsicAttributes & ListItemProps & { children?: ReactNode; }'.

Steps to Reproduce

Link: https://codesandbox.io/s/r0pr5qjnzq
screen shot 2018-08-12 at 17 15 41

Context

I try to use the label to trigger a hidden <input type="file" />

Your Environment

Link to my current package.json and the repo itself

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions