You can now register different styles for WordPress blocks using PHP - no Javascript needed! Use the code here, either in your themes functions.php
file or a plugin.
The name
paramter forms part of the CSS class that is added to the block. Don't forget, this is all that block styles do, they had an additional class which then allows you to style them in a different way.
The class will take the form of is-style-{NAME}
. So in the example here, when the "EyeBrow" style is applied to a heading, that heading block would have the class of is-style-eyebrow
.
How do i add attributes to this?