Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glamorous -> Emotion -- Prop filtering? #653

Closed
brentertz opened this issue May 10, 2018 · 4 comments
Closed

Glamorous -> Emotion -- Prop filtering? #653

brentertz opened this issue May 10, 2018 · 4 comments

Comments

@brentertz
Copy link
Contributor

Greetings! Recent conversations about the potential deprecation of Glamorous led me to consider a migration to Emotion. paypal/glamorous#419

While the API's are similar, they are not quite identical. One feature that my project relies on heavily in Glamorous is prop filtering, as described by the rootEl, forwardProps, and filterProps sections at https://glamorous.rocks/api

Would this be something that you might consider including in Emotion?

Thanks!

@Andarist
Copy link
Member

Andarist commented May 11, 2018

There is shouldForwardProp feature option and you can use it like this:

import isPropValid from '@emotion/is-prop-valid'

const StyledTextarea = styled(TextareaAutosize, { shouldForwardProp: isPropValid })({
  fontSize: '16px',
})

You can also look at this test case to see how it can be used.

@brentertz
Copy link
Contributor Author

brentertz commented May 11, 2018

@Andarist Thanks for pointing out shouldForwardProps option.

Are those options part of the public API? I could find no references to them in the documentation, only in the source here and here.

Oooh, just noticed the is-prop-valid comment above... investigating more...

@Andarist
Copy link
Member

Yeah, they are part of the public API. They might have not been documented though - this is quite a new option, implemented not that long time ago. Would be good to have a docs for it, I've created an issue about it here. We'd love some help with that 😉

@brentertz
Copy link
Contributor Author

Thank you. It appears as though the shouldForwardProp option will work fine for my use case with the forthcoming addition of #670

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants