Content · Gutenberg

Search Bar block for WordPress

Styled search field and button for site search with live AJAX suggestions option.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Styled search field and button for site search with live AJAX suggestions option.

Inspector panels on this block: Search Settings. Those titles come from index.js, not from a shared template.

Behavior controls: “Style — Alignment” options: Left, Center, Right, Full Width.

Where to find it

Gutenberg inserter → Content → search “Search Bar” (block name `blockenberg/search-bar` in block.json). Style it in the sidebar after insert.

How to use Search Bar block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Search Bar”, insert it. Category: Content.
  3. Configure inspector controls that exist on this block. Open Search Settings. Set “Placeholder”, “Show Button”, “Button Icon”, “Button Label”.
  4. Check the published page. The view script reads HTML data attributes: data-live. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
PlaceholderText field in the inspector. block.json default: Search…. Saved as `placeholder`.
Show ButtonOn/off toggle in the inspector. On by default. Saved as `showBtn`.
Button IconOn/off toggle in the inspector. On by default. Saved as `btnIcon`.
Button LabelText field in the inspector. block.json default: Search. Saved as `btnLabel`.
Live AJAX SearchOn/off toggle in the inspector. Off by default. Saved as `liveSearch`.
Style — AlignmentSelect control; the chosen value is saved on the block. Options: Left; Center; Right; Full Width. block.json default: center. Saved as `alignment`.
Max Width (px)Numeric range control in the inspector. Range 200–960. block.json default: 560. Saved as `maxWidth`.
Field Height (px)Numeric range control in the inspector. Range 32–80. block.json default: 48. Saved as `fieldHeight`.
Border Radius (px)Numeric range control in the inspector. Range 0–40. block.json default: 8. Saved as `borderRadius`.
Font Size (px)Numeric range control in the inspector. Range 12–24. block.json default: 15. Saved as `fontSize`.
Field BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `fieldBg`.
Field BorderColor control in the inspector. block.json default: #d1d5db. Saved as `fieldBorder`.
Field TextColor control in the inspector. block.json default: #111827. Saved as `fieldText`.
Button BackgroundColor control in the inspector. block.json default: #6c3fb5. Saved as `btnBg`.
Button TextColor control in the inspector. block.json default: #ffffff. Saved as `btnText`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Search Bar block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Search Bar”. It sits under Content. After insert, open Search Settings and set “Placeholder”, “Show Button”, “Button Icon”, “Button Label”.

What makes Search Bar different from other Blockenberg blocks?

Styled search field and button for site search with live AJAX suggestions option. Inspector labels on this block include “Placeholder”, “Show Button”, “Button Icon”, “Button Label”.

Is the Search Bar Gutenberg block free?

Yes. Search Bar ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Search Bar to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Search Settings).

Related content blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Search Bar from the Gutenberg inserter.

Get Blockenberg