Content · Gutenberg

Spoiler / Reveal block for WordPress

Hide content behind a click-to-reveal button. Perfect for spoilers, quiz answers, bonus tips, or any content that should stay hidden until the reader chooses to see it.

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

Hide content behind a click-to-reveal button. Perfect for spoilers, quiz answers, bonus tips, or any content that should stay hidden until the reader chooses to see it.

Inspector panels on this block: Content, Display, Sizing. Those titles come from index.js, not from a shared template.

Behavior controls: “Spoiler type (preset colors)” options: Warning (amber), Info (blue), Danger (red), Success (green), Neutral (gray).

Where to find it

Gutenberg inserter → Content → search “Spoiler / Reveal” (block name `blockenberg/spoiler` in block.json). Style it in the sidebar after insert.

How to use Spoiler / Reveal block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Spoiler / Reveal”, insert it. Category: Content.
  3. Configure inspector controls that exist on this block. Open Content. Set “Header Background”, “Header Text”, “Colors — Border”, “Button Background”.
  4. Check the published page. The view script reads HTML data attributes: data-opts. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
Header BackgroundColor control in the inspector. block.json default: #fffbeb. Saved as `labelBg`.
Header TextColor control in the inspector. block.json default: #92400e. Saved as `labelColor`.
Colors — BorderColor control in the inspector. block.json default: #f59e0b. Saved as `borderColor`.
Button BackgroundColor control in the inspector. block.json default: #f59e0b. Saved as `btnBg`.
Button TextColor control in the inspector. block.json default: #ffffff. Saved as `btnColor`.
Content BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `contentBg`.
Content TextColor control in the inspector. block.json default: #374151. Saved as `contentColor`.
Header LabelText field in the inspector. block.json default: ⚠ Spoiler Warning. Saved as `label`.
Show Sub-labelOn/off toggle in the inspector. On by default. Saved as `showSubLabel`.
Sub-label textText field in the inspector. block.json default: Click to reveal. Saved as `subLabel`.
Reveal button textText field in the inspector. block.json default: Reveal Spoiler. Saved as `revealBtnText`.
Hide button textText field in the inspector. block.json default: Hide Spoiler. Saved as `hideBtnText`.
Spoiler type (preset colors)Select control; the chosen value is saved on the block. Options: Warning (amber); Info (blue); Danger (red); Success (green); Neutral (gray); Custom colors. block.json default: warning. Saved as `spoilerType`.
Show iconOn/off toggle in the inspector. On by default. Saved as `showIcon`.
☛ Start open in editorOn/off toggle in the inspector. Off by default. Saved as `startOpen`.
Max width (px)Numeric range control in the inspector. Range 300–1200. block.json default: 720. Saved as `maxWidth`.
Padding V (px)Numeric range control in the inspector. Range 8–60. block.json default: 20. Saved as `paddingV`.
Padding H (px)Numeric range control in the inspector. Range 8–80. block.json default: 24. Saved as `paddingH`.
Card radius (px)Numeric range control in the inspector. Range 0–32. block.json default: 12. Saved as `cardRadius`.
Button radius (px)Numeric range control in the inspector. Range 0–50. block.json default: 8. Saved as `btnRadius`.

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 Spoiler / Reveal block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Spoiler / Reveal”. It sits under Content. After insert, open Content and set “Header Background”, “Header Text”, “Colors — Border”, “Button Background”.

What makes Spoiler / Reveal different from other Blockenberg blocks?

Hide content behind a click-to-reveal button. Perfect for spoilers, quiz answers, bonus tips, or any content that should stay hidden until the reader chooses to see it. Inspector labels on this block include “Header Background”, “Header Text”, “Colors — Border”, “Button Background”.

Is the Spoiler / Reveal Gutenberg block free?

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

Can I style Spoiler / Reveal 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: Content, Display, Sizing).

Related content blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Spoiler / Reveal from the Gutenberg inserter.

Get Blockenberg