Search

Help visitors find your content.

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

Category:

For developers

Block Grammar & Markup

<!-- wp:search /-->

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

{
  "label": {
    "type": "string",
    "__experimentalRole": "content"
  },
  "showLabel": {
    "type": "boolean",
    "default": true
  },
  "placeholder": {
    "type": "string",
    "default": "",
    "__experimentalRole": "content"
  },
  "width": {
    "type": "number"
  },
  "widthUnit": {
    "type": "string"
  },
  "buttonText": {
    "type": "string",
    "__experimentalRole": "content"
  },
  "buttonPosition": {
    "type": "string",
    "default": "button-outside"
  },
  "buttonUseIcon": {
    "type": "boolean",
    "default": false
  },
  "query": {
    "type": "object",
    "default": []
  }
}

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

{
  "align": [
    "left",
    "center",
    "right"
  ],
  "color": {
    "gradients": true,
    "__experimentalSkipSerialization": true,
    "__experimentalDefaultControls": {
      "background": true,
      "text": true
    }
  },
  "typography": {
    "__experimentalSkipSerialization": true,
    "__experimentalSelector": ".wp-block-search__label, .wp-block-search__input, .wp-block-search__button",
    "fontSize": true,
    "lineHeight": true,
    "__experimentalFontFamily": true,
    "__experimentalFontWeight": true,
    "__experimentalFontStyle": true,
    "__experimentalTextTransform": true,
    "__experimentalTextDecoration": true,
    "__experimentalLetterSpacing": true,
    "__experimentalDefaultControls": {
      "fontSize": true
    }
  },
  "__experimentalBorder": {
    "color": true,
    "radius": true,
    "width": true,
    "__experimentalSkipSerialization": true,
    "__experimentalDefaultControls": {
      "color": true,
      "radius": true,
      "width": true
    }
  },
  "html": false
}