Avatar

Add a user’s avatar.

This block is available in the latest version of WordPress and does not require the Gutenberg plugin.

Last updated

Category:

For developers

Block Grammar & Markup

<!-- wp:avatar {"userId":4, "size":85,"isLink":true,"align":"right","style":{"spacing":{"margin":{"bottom":"40px"}},"border":{"radius":"47px","width":"3px"},"color":{"duotone":["#000000","#ffe2c7"]}},"borderColor":"vivid-red"} /-->

Context

Context is used to pass values from a block to a descendant block; for example, a query and post template passing the query ID to the inner blocks.

Documentation

Uses context. Optional. Type: Object.

[
  "postType",
  "postId",
  "commentId"
]

Block Attributes

Optional. Type: Object.

Attributes provide the structured data needs of a block. They can exist in different forms when they are serialized, but they are declared together under a common interface.

Documentation

{
  "userId": {
    "type": "number"
  },
  "size": {
    "type": "number",
    "default": 96
  },
  "isLink": {
    "type": "boolean",
    "default": false
  },
  "linkTarget": {
    "type": "string",
    "default": "_self"
  }
}

Block Supports

Optional. Type: Object.

A set of options that enables or disables block controls in the editor, for example gradient colors or padding.

Documentation

{
  "html": false,
  "align": true,
  "alignWide": false,
  "spacing": {
    "margin": true,
    "padding": true
  },
  "__experimentalBorder": {
    "__experimentalSkipSerialization": true,
    "radius": true,
    "width": true,
    "color": true,
    "style": true,
    "__experimentalDefaultControls": {
      "radius": true
    }
  },
  "color": {
    "text": false,
    "background": false,
    "__experimentalDuotone": "img"
  }
}

For developers

View blocks per attribute or block support: