Skip to content

Recommended approach for component theming that uses base tokens #188

Closed Answered by jpudysz
jonathanj asked this question in Q&A

You must be logged in to vote

Oh then that's easy 😎

Define variant in your theme:

const theme = {
    // other keys
    variants: {
         button: {
             type: {
                  // if you want to use color from theme, then move colors above the theme
                  secondary: 'red'
             }
         }
    }
}

component:

const stylesheet = createStyleSheet(theme => ({
    button: {
         variants: theme.variants.button
    }
})

Replies: 1 comment 3 replies

You must be logged in to vote
3 replies
@jonathanj

@jpudysz

Answer selected by jonathanj
@jonathanj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants