diff --git a/docs/how-to-guides/themes/theme-json.md b/docs/how-to-guides/themes/theme-json.md index 32f9bacacefc5..83c07afe3a37d 100644 --- a/docs/how-to-guides/themes/theme-json.md +++ b/docs/how-to-guides/themes/theme-json.md @@ -195,6 +195,7 @@ The settings section has the following structure and default values: }, "custom": { ... }, "spacing": { + "customMargin": false, /* true to opt-in */ "customPadding": false, /* true to opt-in, as in add_theme_support('custom-spacing') */ "units": [ "px", "em", "rem", "vh", "vw" ], /* filter values, as in add_theme_support('custom-units', ... ) */ }, @@ -377,6 +378,12 @@ Each block declares which style properties it exposes via the [block supports me "text": "value" }, "spacing": { + "margin": { + "top": "value", + "right": "value", + "bottom": "value", + "left": "value" + }, "padding": { "top": "value", "right": "value", diff --git a/docs/reference-guides/block-api/block-supports.md b/docs/reference-guides/block-api/block-supports.md index 1f5ab06e7b7b1..5b920ab3b5adf 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -497,6 +497,7 @@ supports: { - Type: `Object` - Default value: null - Subproperties: + - `margin`: type `boolean` or `array`, default value `false` - `padding`: type `boolean` or `array`, default value `false` This value signals that a block supports some of the CSS style properties related to spacing. When it does, the block editor will show UI controls for the user to set their values, if [the theme declares support](/docs/how-to-guides/themes/theme-support.md#cover-block-padding). @@ -504,6 +505,7 @@ This value signals that a block supports some of the CSS style properties relate ```js supports: { spacing: { + margin: true, // Enable margin UI control. padding: true, // Enable padding UI control. } } @@ -511,12 +513,13 @@ supports: { When the block declares support for a specific spacing property, the attributes definition is extended to include the `style` attribute. -- `style`: attribute of `object` type with no default assigned. This is added when `padding` support is declared. It stores the custom values set by the user. +- `style`: attribute of `object` type with no default assigned. This is added when `margin` or `padding` support is declared. It stores the custom values set by the user. ```js supports: { spacing: { - padding: [ 'top', 'bottom' ], // Enable padding for arbitrary sides. + margin: [ 'top', 'bottom' ], // Enable margin for arbitrary sides. + padding: true, // Enable padding for all sides. } } ```