You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Block API: Choose a Block-Style for a Block Variation #21292
Is your feature request related to a problem? Please describe.
I would like to choose a different style for my variations. With the current API the that is not possible.
changed the title [-]Block API: Choose a Block-Style for a Block Variations [/-][+]Block API: Choose a Block-Style for a Block Variation[/+]on Mar 31, 2020
You can do it by setting explicitly className attribute to the class name that the given style uses in the produced content. I’m aware that it isn’t the best way to achieve it so I agree that we should find a better way. I think your proposal sounds reasonable. We properly should use the name styleVariation to distinguish it from the style you define on the server for the block.
I think using className is acceptable too, mainly for two reasons:
Style variations are already an arguably low-level API, since they are just a wrapper for custom classes. For something more robust, proper Variations may be a better choice.
With the planned work in Global Styles, I'd rather not overload the term (and property name) style, since that may soon come to mean much more than just custom classes.
Activity
[-]Block API: Choose a Block-Style for a Block Variations [/-][+]Block API: Choose a Block-Style for a Block Variation[/+]gziolo commentedon Mar 31, 2020
You can do it by setting explicitly className attribute to the class name that the given style uses in the produced content. I’m aware that it isn’t the best way to achieve it so I agree that we should find a better way. I think your proposal sounds reasonable. We properly should use the name styleVariation to distinguish it from the style you define on the server for the block.
gziolo commentedon Mar 31, 2020
@mcsf or @youknowriad any thoughts on this proposal?
youknowriad commentedon Apr 1, 2020
Personally, I feel using the className is a very reasonable way of doing this.
mcsf commentedon Apr 1, 2020
I think using className is acceptable too, mainly for two reasons:
style, since that may soon come to mean much more than just custom classes.goaround commentedon Apr 1, 2020
@gziolo the
classNameattribute works for me. Thanks for pointing it out to me. Properly it would be good to add this to the documentation?gziolo commentedon Apr 27, 2020
I opened #21927 where I added an example. I hope it will help other folks 👍