Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add variations key to block.json JSON schema definition #42539

Merged
merged 8 commits into from
Jul 20, 2022
28 changes: 28 additions & 0 deletions docs/reference-guides/block-api/block-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,34 @@ It provides structured example data for the block. This data is used to construc

See the [the example documentation](/docs/reference-guides/block-api/block-registration.md#example-optional) for more details.

### Variations

- Type: `array`
fabiankaegy marked this conversation as resolved.
Show resolved Hide resolved
- Optional
- Localized: Yes (`title`, `description`, and `keywords` of each variation only)
- Property: `variations`
fabiankaegy marked this conversation as resolved.
Show resolved Hide resolved

```json
{
fabiankaegy marked this conversation as resolved.
Show resolved Hide resolved
"variations": [
{
"name": "example",
"title": "Example",
"attributes": {
"level": 2,
"message": "This is an example!"
},
"scope": [ "block" ],
"isActive": [ "level" ]
}
]
}
```

_Note: JavaScript functions (isActive) and React elements (icon) can't be used in block.json_
fabiankaegy marked this conversation as resolved.
Show resolved Hide resolved

See the [the variations documentation](/docs/reference-guides/block-api/block-variations.md) for more details.

### Editor Script

- Type: `WPDefinedAsset` ([learn more](#wpdefinedasset))
Expand Down