Style Hooks


A React component that provides access to the theme object defined in your ThemeProvider.


  • name <string>

    An optional prop for consuming only the key in the theme that matches this string

    import {ThemeConsumer} from '@style-hooks/core'
    // Using a global theme
    const Component = () => (
    {theme => {/*do stuff*/}}
    // Using a specific theme, in this example the theme for <Text>
    const Component = () => (
    <ThemeConsumer name='text'>
    {textTheme => {
    // This will only provide the theme defined
    // for theme[name]

CodeSandbox example

Below is a complete ThemeConsumer example

Continue to useTheme()
NPM icon
MIT License ©2019
Jared Lunde