隐藏和显示额外内容。

  • 名称: core/details
  • 类别: 文本
  • API 版本: 3
  • 块类型: 混合(静态保存 + 服务器增强)
  • 关键词: summary, toggle, disclosure

属性

通过 attributes 属性在 block.json 中定义。

属性类型默认值描述
showContentbooleanfalse—
summaryrich-text—来源: rich-text。 选择器: summary。 角色: content
namestring—来源: attribute。 选择器: .wp-block-details。 HTML 属性: name
placeholderstring——

支持

通过 supports 属性在 block.json 中定义。

块标记

这是一个 混合块。它保存静态标记,服务器在渲染期间可能会对其进行增强。

<!-- wp:details {"summary":"Details Summary"} -->
<details class="wp-block-details"><summary>Details Summary</summary>
    <!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
    <p>Details Content</p>
    <!-- /wp:paragraph -->
</details>
<!-- /wp:details -->

来源