Skip to content

[DevHub] Block Editor Handbook -> Reference Guides -> Block API Reference -> Supports -> Spacing has not working example for default attributes #1804

@silaskoehler

Description

@silaskoehler

Issue Description

The example code for default attributes for spacing is not correct i think.

attributes: {
    style: {
        margin: 'value',
        padding: {
            top: 'value',
        }
    }
}

This does not work for me, but it worked, if i add spacingto the object:

attributes: {
    style: {
        spacing: {
            margin: 'value',
            padding: {
                top: 'value',
            }
        }
    }
}

URL of the Page with the Issue

https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing

Section of Page with the issue

Spacing

Suggested Fix

change documentation example to:

attributes: {
    style: {
        spacing: {
            margin: 'value',
            padding: {
                top: 'value',
            }
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions