Generally used in block-controls or inspector.
A label for the field. Should not be used when field goes in block-controls.
- Type:
String
- Required: No
Used to add help text below the field. Should not be used when field goes in block-controls.
- Type:
String
- Required: No
Defines where you want to show the field. By default a field would be added to the block however it can be added to the sidebar settings by using inspector
or in the block-controls by using block-controls
.
- Accepts:
block-controls
,inspector
- Type:
String
- Required: No
Add icons to be added for selection.
- Type:
Object
- Required: Yes
Example:
view: {
type: 'string',
field: {
type: 'icons-toolbar',
placement: 'block-controls',
controls: [
{
icon: 'list-view', // Dashicon.
title: 'List View',
value: 'list',
},
{
icon: 'grid-view',
title: 'Grid View',
value: 'grid',
},
],
},
},
- Type:
string
Read more about defining attributes on official Gutenberg handbook.