You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think PandaCSS should expose a split css props and non-css props helper function. This will be very helpful when building generic components and want to merge default styles to the css styles props.
Problem Statement/Justification
When trying to merge styles in a generic component for example:
exportfunctionComponent({ children, ...props}: HTMLStyledProps<"div">){constcssProps={};//How to extract this?constrestProps={};//How to extract this?return(<styled.divclassName={css({display: "flex",height: "20",width: "20"},cssProps)}{...restProps}>{children}</styled.div>);}
Right now exist no way to extract the cssProps and non-cssProps of all the props of the component.
This discussion was converted from issue #1560 on October 21, 2023 17:15.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I think PandaCSS should expose a split css props and non-css props helper function. This will be very helpful when building generic components and want to merge default styles to the css styles props.
Problem Statement/Justification
When trying to merge styles in a generic component for example:
Right now exist no way to extract the cssProps and non-cssProps of all the props of the component.
Proposed Solution or API
A splitCssProps helper function will be helpful
Already exist a splitProps function in the PandaCSS repo https://github.com/chakra-ui/panda/blob/main/packages/shared/src/split-props.ts but it need some adjustments and be exposed.
Alternatives
Using the isCssProperty function i've build my own splitCssProps helper function
But it should be nice if a similar or better function was build-in in PandaCSS.
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions