blocks/blocks

Consider how to handle component "variants"

johno opened this issue · 2 comments

johno commented

When a component has a variant applied we should expose a way for edits to affect the variant styles directly. For example, when you click on a heading link and you want to apply styles to all heading links rather than the individually selected element.

This sounds great! I've been thinking about variants a lot lately. Wondering if we can do something that's agnostic that can apply to other libraries outside of theme-ui? Not sure what it would look like, but maybe just supporting components like ThemeProvider that can define propertyControls for controlling nested component variants. Which I think might already work 🤔 probably just needs some finessing.

johno commented

Yeah, I think for now expose some type of property control to handle variants. It definitely won't have to be tied to Theme UI since we'll be adding an adapter layer so you can run your own plugins based on the event. So we'll likely have a "variant updated" type handler which can be overridden.