unplugin-icons
unplugin-icons copied to clipboard
Default class is not merged when using react
Similar to issue #53, but React not Vue.
Setting className
on a icon component overrides the default class set in the config. This is because inside the declaration the className
prop is set to $defaultClass
, but after that props is spread and overrides className
This is how the declaration kinda looks (got it via console.logging the component)
const icOutlineShoppingCart = (props) => /* @__PURE__ */ _jsxDEV("svg", {
style: {
color: "red"
},
className: "my-default-class",
...props,
// ...
});
IMO it should be something like
const icOutlineShoppingCart = ({className, style, ...props}) => /* @__PURE__ */ _jsxDEV("svg", {
style: {
color: "red"
...(style || {}) // might be undefined
},
className: "my-default-class" + " " + (className || ""), // could be undefined too
...props,
// ...
});