Skip to content

Nest variants and configuration options inside theme #1291

@hasparus

Description

@hasparus

Is your feature request related to a problem? Please describe.

Currently, the Theme object is flat. We're compliant with System UI Theme specification, so scales have to be flat, but Variants (and there are quite a lot of them), and options (similarly) don't have to be, and they're not as important as scales.

Right now we kind of enforce on the user to keep their theme object "in order" manually, with whitespaces, regions or manual sorting. Somebody with an ESLint rule sorting object keys will have a really bad time reading interweaved scales, variants and options.

Describe the solution you'd like

I think we could keep them nested under variants and options properties.
Of course, we'd have deprecate the old API and support both scenarios for a while, what's a bit annoying from maintenance perspective.

Describe alternatives you've considered

Leaving it as it is.

Additional context

We might have even more options in the near future.
image


@lachlanjc @atanasster @dcastil, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededreleasedThis issue/pull request has been released.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions