Skip to content

Instantly share code, notes, and snippets.

@ryanwelcher
Created May 20, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanwelcher/d0fa1985bb92dbc95620f606284d2b4e to your computer and use it in GitHub Desktop.
Save ryanwelcher/d0fa1985bb92dbc95620f606284d2b4e to your computer and use it in GitHub Desktop.
Defining default values for Background color, text color, link color, padding and margin for custom blocks
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "create-block/block-supports-test",
"version": "0.1.0",
"title": "Block Supports Test",
"category": "widgets",
"icon": "smiley",
"description": "Example block written with ESNext standard and JSX support – build step required.",
"attributes":{
"content": {
"type": "string",
"selector": "p"
},
"style": {
"type": "object",
"default": {
"color": {
"background": "#aabbcc",
"text": "#00ff00"
},
"elements": {
"link": {
"color": {
"text": "blue"
}
}
},
"spacing": {
"padding": {
"top": "22px",
"right": "22px",
"bottom": "22px",
"left": "22px"
},
"margin": {
"top": "42px",
"right": "42px",
"bottom": "42px",
"left": "42px"
}
}
}
}
},
"supports": {
"color": {
"background": true,
"text": true,
"link": true
},
"spacing": {
"margin":true,
"padding": true
}
},
"textdomain": "block-supports-test",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment