Implement a reliable, consistent, easy to use system for HTML classes #1362
Labels
[Feature] Block API
API that allows to express the block paradigm.
[Type] Task
Issues or PRs that have been broken down into an individual action to take
Milestone
We are at a point where we need to make a final wrap on how to target blocks with CSS, make it explicit and not easy to circumvent.
Proposal
Generate a class with the following structure:
wp-block-{blockName}
for core blockswp-block-{namespace-blockName}
for 3rd parties.Approach A
Pass a property to the save implementation as
htmlClass
, generated by us but exposed to use:This gives some flexibility (you can avoid adding it for blocks like text, or headings) but also forces some boilerplate on implementation. It also gives the chance of adding it wherever we want on the
edit
render as well.Approach B
Go with a magical approach by applying the class to the wrapper element through our serialization flow.
The text was updated successfully, but these errors were encountered: