Style props with headless components #1024
-
Our design system is using headless components that uses a Would it be possible to pass those props to a css function to convert them to classes? Here's an example: const Button = (props) => {
const systemProps = extractSystemProps(props);
const systemPropsStyles = css(systemProps);
return <ButtonPrimitive className={cx(buttonStyles, systemPropsStyles)}>{props.children}</ButtonPrimitive>
}
Same with an |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
fyi there's a
as long as they are statically analyzable, yes, you can use the special
rename sx to |
Beta Was this translation helpful? Give feedback.
fyi there's a
<Box />
(orbox()
) pattern built-in the default presetas long as they are statically analyzable, yes, you can use the special
css
prop for thatthere's a
isCssProperty
exported fromstyled-system/jsx
if you want to split propsrename sx to
css