TheMightyPenguin / dessert-box

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

Support for React.Component argument to styled #32

Closed brettinternet closed 1 year ago

brettinternet commented 1 year ago

Would it be possible to support passing a React component to styled like so?

type Props = { className?: string }

const Component: React.FC<Props> = ({ className }) => <div className={className}>...</div>

const StyledComponent = styled(Component, { background: 'blue' })
TheMightyPenguin commented 1 year ago

Hey @brettinternet I don't think this will be possible, as the argument for functions made with addFunctionSerializer need to be serializable and components are not :( As we use this function internally, this is a technical limitation