Overview

What It Is and Where It Lives

Accordion Item is the child partial that lives inside an Accordion block. Its parent field in block.json restricts it exclusively to fc-blocks/accordion, so it never appears as a standalone block. When you're editing a page and working inside an Accordion block, the block inserter inside it offers Accordion Item as the child block to add. Each Accordion Item you add becomes one collapsible row in the finished accordion on the front end.

Why You'd Reach for It

The Accordion parent block establishes the accordion container, but it has no content of its own — all the actual rows come from Accordion Item partials nested inside it. Each partial gives you independent control over that row's heading text, its heading markup, and its body content (via inner blocks), so you can build an accordion with as many distinct items as needed, each with its own title, typography treatment, and arbitrary rich content in the body.

Key Capabilities

  • Item title — free-text field typed directly in the editor canvas; supports <mark> tags for accent styling
  • Title Heading Tag — choose the semantic HTML element rendered for the title (H1–H6, P, or Span) independently of its visual size
  • Title Heading Class — choose the visual typography style applied to the title (H1–H6, strong variants, caption variants, Sub Title, or Inherit) independently of its semantic tag
  • Arbitrary inner-block body content — the item's body panel accepts any blocks via InnerBlocks, so body content is fully flexible
  • HTML Anchor — set a unique page anchor on the item for deep-linking directly to a specific accordion row
  • Hide Block — checkbox to suppress the item from the front end without deleting it

DOM Structure

<div id="{anchor}" class="accordion__item" style="{styles}">
  <!-- id attribute omitted when HTML Anchor is empty -->
  <!-- style attribute includes display:none when Hide Block is checked -->
  <span tabindex="0" class="accordion__heading">
    <{titleHeadingTag} class="accordion__title {titleHeadingClass}">
      {title}
    </{titleHeadingTag}>
    <!-- titleHeadingTag defaults to h3; titleHeadingClass defaults to h5 -->
    <div class="accordion__toggle">
      <span class="toggle-text">{toggleText}</span>
      <!-- toggle text inherited from parent accordion block setting -->
      <svg class="toggle-icon" width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M1.5 1.97949L8 7.97949L14.5 1.97949" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
      </svg>
    </div>
  </span>
  <div class="accordion__body">
    <!-- inner blocks content rendered here — one or more editor blocks -->
  </div>
</div>

DOM Notes

Dynamic Behavior

Accordion Item Open/Close Interaction

The accordion item's expand/collapse behavior is driven by the parent fc-blocks/accordion block's JavaScript on the front end. Each item renders with a div.accordion__item wrapper containing a span.accordion__heading (which is keyboard-focusable via tabindex="0") and a div.accordion__body that holds the inner block content. Clicking or focusing the heading toggles the body's visibility — the heading/toggle area acts as the interactive trigger, and the chevron SVG icon inside div.accordion__toggle rotates or animates to indicate open/closed state. The specific class toggling and animation is managed by the parent accordion block's script, not by this item block itself.

Hide Block (Display None) State

When the Hide Block checkbox is checked in the Other Settings panel of the block inspector, the rendered div.accordion__item receives an inline style="display:none;" on the front end. The item is completely removed from the visual flow and is invisible to site visitors. Unchecking the option removes that inline style and the item renders normally. This is a server-side conditional applied at render time — it is not toggled dynamically by the visitor; it is a content-management tool for the editor to suppress an item without deleting it.

HTML Anchor (ID Assignment)

When a value is entered in the HTML Anchor field (in the Other Settings panel), that value is written as the id attribute on the outermost div.accordion__item wrapper (e.g. <div id="my-anchor" class="accordion__item">). An empty value results in id="". This enables deep-linking directly to a specific accordion item via a URL fragment (e.g. page-url/#my-anchor). The anchor is inert on the front end until a visitor or link references it — at that point the browser scrolls to and/or focuses that item.

Technical Documentation

Parent Block

Accordion Item lives inside the Accordion block. To add an Accordion Item, open an Accordion block in the editor and use the block inserter to add Accordion Item children. Each Accordion Item represents one collapsible panel — a clickable heading row that expands to reveal its inner content.

Canvas Controls

Title

  • Attribute: title
  • Type: Single-line text field (rendered directly on the editor canvas, not in the inspector sidebar)
  • Default: (empty)

What it controls — Sets the visible heading text displayed in the accordion item's clickable trigger row. On the front end this text is wrapped in the heading element selected via Title Heading Tag and styled by the Title Heading Class.

Notes — <mark> tags may be typed directly into the field to apply accent styling to portions of the title text. The help text in the editor reminds editors of this capability.

Block Settings

Title Heading Tag

  • Attribute: titleHeadingTag
  • Type: Single-select dropdown
  • Default: h3
  • Panel: Controls

What it controls — Sets the HTML element used to wrap the accordion item's title on the front end. Choosing the correct tag for the page's heading hierarchy helps with accessibility and SEO without affecting visual appearance (visual size is controlled separately by Title Heading Class).

Options

Label Output element
H1 <h1>
H2 <h2>
H3 <h3> (default)
H4 <h4>
H5 <h5>
H6 <h6>
P <p>
Span <span>

Title Heading Class

  • Attribute: titleHeadingClass
  • Type: Single-select dropdown
  • Default: h5
  • Panel: Controls

What it controls — Applies a CSS class to the accordion title element, controlling its visual size and style independently of the semantic heading tag. This allows the document outline (Title Heading Tag) and the visual presentation to be set separately.

Options

Label CSS class applied
H1 h1
H2 h2
H3 h3
H4 h4
H5 h5 (default)
H6 h6
H1 – Strong h1 strong
H2 – Strong h2 strong
H3 – Strong h3 strong
H4 – Strong h4 strong
H5 – Strong h5 strong
H6 – Strong h6 strong
H1 Caption h1 caption
H2 Caption h2 caption
H3 Caption h3 caption
H4 Caption h4 caption
H5 Caption h5 caption
H6 Caption h6 caption
Sub Title sub-title
Inherit inherit

HTML Anchor

  • Attribute: otherSettings[1]
  • Type: Single-line text field
  • Default: (empty)
  • Panel: Other Settings

What it controls — Adds an id attribute to the accordion item's outer wrapper <div>, making that specific item directly linkable via a URL hash (e.g. https://example.com/page/#my-anchor). Useful for deep-linking to a specific accordion panel.

Notes — Enter one word or a hyphenated phrase with no spaces. Each anchor on a page must be unique.

Hide Block

  • Attribute: otherSettings[2]
  • Type: Checkbox
  • Default: unchecked (false)
  • Panel: Other Settings

What it controls — When checked, adds display:none; as an inline style to the accordion item's outer wrapper, hiding it entirely from front-end visitors. The block remains present in the editor for future use.

Cross-Block Relationships

The parent Accordion block controls the toggle text that appears alongside the expand/collapse icon on each item's heading row. The Accordion Item reads this value from its parent at render time via the toggleText attribute and stores it locally as itemToggleText. Editors set toggle text on the parent Accordion block, not on each individual item.

The accordion item's body content is supplied via InnerBlocks — any block the editor inserts as a child of the Accordion Item becomes the expanded panel content rendered inside <div class="accordion__body">.

Theme-Level Integrations

The Title Heading Class options (H1–H6 base sizes, Strong variants, Caption variants, Sub Title, and Inherit) correspond to CSS classes defined in the theme's typographic stylesheet. The visual output of each class is determined by the theme's global heading styles, meaning a change to the theme's h3 style will automatically update all accordion item titles using the h3 heading class.