@wordpress/block-library
Version:
Block library for the WordPress editor.
24 lines (21 loc) • 536 B
JavaScript
/**
* WordPress dependencies
*/
import { RichText, useBlockProps, InnerBlocks } from '@wordpress/block-editor';
export default function save( { attributes } ) {
const { name, showContent } = attributes;
const summary = attributes.summary ? attributes.summary : 'Details';
const blockProps = useBlockProps.save();
return (
<details
{ ...blockProps }
name={ name || undefined }
open={ showContent }
>
<summary>
<RichText.Content value={ summary } />
</summary>
<InnerBlocks.Content />
</details>
);
}