hxf31891 / react-gradient-color-picker

An easy to use color/gradient picker for React.js
MIT License
146 stars 49 forks source link

Forward `className` and `style` to the element root #18

Closed jourdanrodrigues closed 2 years ago

jourdanrodrigues commented 2 years ago

Description

While it's possible to target the internal elements via CSS, it's definitely annoying.

Forwarding a style and a className to the root component allows for a customization without the need for a wrapper or relying on internal naming/structure (so deeply, at least).

Also, Styled-Components works entirely based on the className property, so in order for styled(GradientPicker) to work, it has to make use of the className property.

Also, I spread the props (both received and forwarded) for better diff and readability.