-
Hey! I'm wondering how could I go about further reducing my styles footprint by reducing the amount of duplicate styles in variants. Let's say I have the following theme. const theme = {
colors: {
text: '#111',
},
variants: {
body: {
color: 'text',
padding: 0,
},
text: {
color: 'text',
padding: '1rem',
},
},
}; Clearly, both Is there a way to extend variants inside the theme? Or is my implementation of variants incorrect? Should I perhaps create one common variant and then extend it from individual components? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Not the only way, and this example maybe isn't the best, but you can inherit variants from other variants: variants: {
textBase: {
color: 'text',
},
body: {
variant: 'variants.textBase',
padding: 0,
},
text: {
variant: 'variants.textBase',
padding: 3,
},
} Hopefully we'll have support for merging multiple variants together in the |
Beta Was this translation helpful? Give feedback.
Not the only way, and this example maybe isn't the best, but you can inherit variants from other variants:
Hopefully we'll have support for merging multiple variants together in the
sx
prop land before v1, which would offer another approach