question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nest variants and configuration options inside theme

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
hasparuscommented, May 5, 2021

🚀 Issue was released in v0.8.0 🚀

2reactions
hasparuscommented, Nov 23, 2020

I think we should totally put Theme UI config in a separate object (options as you suggest, config, etc), since that’s not part of the Theme specification & it’s weird it’s just there alongside “content” rn.

Separate object would be IMO the most elegant, but I’d keep them inside theme.options, because it allows to read them on the type level in “strict mode”. They could affect how the types work. (e.g. options.strictMode.allowStrings: false or options.strictMode.scales: ['colors', 'space'])

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variants - Theme UI
Variants allow you to define the styles used across multiple buttons, typographic elements, or any element in your theme object. For example, you...
Read more >
Theme Styles Configuration - BigCommerce Dev Center
Theme variations always appear at the top of the Theme Styles panel. These variations are defined only in config.json , and their definition...
Read more >
Configure build variants | Android Developers
This page shows you how you can configure build variants to create different versions of your app from a single project and how...
Read more >
Theming - Material UI - MUI
Changing the theme configuration variables is the most effective way to match MUI to your needs. The following sections cover the most important...
Read more >
MUI v5: nested components styles in variant - theme
Is it possible to style nested structures in MUI v5 variant in theme? So it should work like this: const theme = createTheme({...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found