We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Just getting started with rebass. How can I access the theme from anywhere ? Does rebass provide any helper for that ?
my use case: I am extending a component:
const Item = styled(Container)` &:hover { background-color: #eee; cursor: pointer; } `;
so I would like to use a color key from the theme instead of hardwiring the color as I did above
The text was updated successfully, but these errors were encountered:
The Rebass.Provider component is a wrapper around styled-components' ThemeProvider (https://www.styled-components.com/docs/advanced#theming). If you're using the theme provider, you should be able to access the theme from props, e.g. props.theme.colors.blue.
Rebass.Provider
ThemeProvider
props.theme.colors.blue
To use the theme outside of a React app, you can also manually import the theme import { theme } from 'rebass'
import { theme } from 'rebass'
Sorry, something went wrong.
Thanks, found the styled-components withTheme helper, which does what I was looking for. Works great now.
styled-components
withTheme
No branches or pull requests
Just getting started with rebass. How can I access the theme from anywhere ? Does rebass provide any helper for that ?
my use case: I am extending a component:
so I would like to use a color key from the theme instead of hardwiring the color as I did above
The text was updated successfully, but these errors were encountered: