Skip to content

Extending styles of multiple variants to form another variant #1208

@a-y-u-s-h

Description

@a-y-u-s-h

Is your feature request related to a problem? Please describe.
Currently the variant prop accepts a string and allows creating variants by extending a single variant. It's not really a problem, but doing so results in bigger theme files compared to a scenario where the variant key could take an array or a string, and then merge all their styles in order to create resulting variant.

Describe the solution you'd like
variant key should be able to accept a string or an array of variants, and then if it's a string - it behaves like how it behaves right now but if it's an array: it should merge the styles of those variants in order that they're mentioned in - sort of like how we extend styles in SCSS. This will result in less number of variants and more crazy combinations.

Describe alternatives you've considered
SCSS does this properly, but I just use Theme UI and then just extend one variant and copy styles from the variants that I want to extend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions