Attributes - Registering

Last modified:

Of course, blocks without dynamic data are kinda boring! Attributes allow you to add data to your blocks and are comparable to custom fields that you know from solutions like ACF or Metabox.

Custom attributes are registered using the blockstudio property inside the block.json file.

      "$schema": "",
      "apiVersion": 2,
      "name": "blockstudio/native",
      "title": "Native Block",
      "category": "text",
      "icon": "star-filled",
      "description": "Native Blockstudio block.",
      "keywords": [
      "version": "1.0.0",
      "textdomain": "blockstudio",
      "supports": {
        "align": true
      "blockstudio": {
        "attributes": [
            "id": "message",
            "type": "text",
            "label": "My message"


And that's it! You've just registered your first custom attribute:

text field

Custom icon

Custom SVGs icons for blocks can be registered like so:

      "blockstudio": {
        "icon": "<svg></svg>"


WordPress doesn't allow for custom SVG icons inside its own block.json icon key, only Dashicons IDs are allowed here.