Can't override `shouldForwardProp`
See original GitHub issueBug report
Describe the bug
When using the chakra
factory function, users should be able to pass a custom shouldForwardProp
function to replace that functionality for their custom component.
Minimal reproduction
https://codesandbox.io/s/distracted-cloud-ncioj?file=/src/App.tsx
Expected behavior
Base div
element should not have hello="true"
attribute attached.
Additional context
Users can specify the shouldForwardProp
option, but it is always overridden inside styled
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Override existing styles using styled system - Stack Overflow
Now I want to overrides existing styles by using Styled System ... import shouldForwardProp from '@styled-system/should-forward-prop'; ...
Read more >API Reference - styled-components
shouldForwardProp works much like the predicate callback of Array.filter. A prop that fails the test isn't passed down to underlying components, ...
Read more >styled() - MUI System
It adds by default the shouldForwardProp option (that can be overridden), taking into account all props used internally in the MUI components: ownerState ......
Read more >TypeScript - Emotion
Forwarding props. Sometimes you want to wrap an existing component and override the type of a prop. Emotion allows you to specify a...
Read more >Customizing Material UI Styles with parameters and props
Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting your device. Your browser can't play this video.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jvmazagao Nope!
shouldForwardProp
just determines whether a prop is also forwarded to the underlying html element or not. So in this case,<div hello="true" class="css-0">
is rendered, but it should just be<div class="css-0">
sinceshouldForwardProp
returnsfalse
forhello
. It’s really just thatshouldForwardProp
should come before we spread the options insidestyled
😁Should be an easy one! 😄