Templarian / MaterialDesign-React

Dist for Material Design Icons React Component for JS/TypeScript
https://materialdesignicons.com
MIT License
142 stars 20 forks source link

Spread extra props through #13

Closed mririgoyen closed 6 years ago

mririgoyen commented 6 years ago

As a user of @mdi/react, I would like to pass other props through to the underlying <svg> object, such as className, so that I can add additional attributes to the Icon or Stack.

Our use case is specifically className, used to place error classes on icons and change their appearance via CSS.

Templarian commented 6 years ago

Just a note about how I'm implementing this with <Stack/>. Since Stack creates the SVG element

<Stack className="foo">      = <svg class="foo">
  <Icon className="bar" />   =   <path class="bar"/>
</Stack>                     = </svg>

This means that a single <Icon/> by itself will map to <svg/> and one will have to use the > path selector in their CSS.