Skip to content

Need help with Spacing Support in block.json #53603

Answered by stokesman
realthemes asked this question in Q&A
Discussion options

You must be logged in to vote

That bit of documentation isn't instructing how to set defaults but merely giving an (apparently incorrect) example of what the attributes will look like once they been customized by the user. To use them as the default they have to be under the default property of your attribute. Then spacing settings have to be under the spacing property (this is left out in the doc’s example). Like so:

    "attributes": {
      "style": {
        "type": "object",
        "default": {
          "spacing":{"padding":{"top":"64px"}}
        }
      }
    }

I figured this out by setting padding on an example block and then switching to the Code editor to see how the attributes were output. For example, he…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@realthemes
Comment options

Answer selected by realthemes
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants