TheMightyPenguin / dessert-box

An utility to create a Box component from your vanilla-extract + sprinkles tokens.
MIT License
343 stars 20 forks source link

"as" prop being passed to rendered component? #25

Closed fshowalter closed 1 year ago

fshowalter commented 1 year ago

Hey, I could be mistaken, but doesn't this line (https://github.com/TheMightyPenguin/dessert-box/blob/746e9ba797a58dd645a6945579de04341f16dad2/packages/react/src/index.ts#L104) mean the "as" prop will be spread to the rendered component? Prior to this it was destructured out (https://github.com/TheMightyPenguin/dessert-box/blob/e39aa98c535f6ef086f7d32c0a03bfbf1be75b86/packages/react/src/index.ts#L69) and not passed.

React seems happy to take the prop and renders it, so <Box as="span">Span Content</Box> renders <span as="span">Span Content</span>.

prncss-xyz commented 1 year ago

Which then triggers this kind of error in html validator: "Attribute as not allowed on element button at this point"

https://validator.w3.org/

TheMightyPenguin commented 1 year ago

@fshowalter @prncss-xyz just published 0.7.3 with this fix!