0.3.0 • Published 3 years ago
headless-blocks v0.3.0
Headless Blocks
Install
npm install headless-blocks
Use
import React from 'react'
import {HeadlessBlocks} from 'headless-blocks';
// Example of a custom component you can make to be rendered for any block.
import {MyCoreParagraph} from './CoreParagraph.js';
import {MyCoreHeading} from './CoreHeading.js';
export default () => {
return (
<HeadlessBlocks
postContent={ '<!-- wp:paragraph --><p>I am the raw HTML content generated by the WordPress Block Editor.</p><!-- /wp:paragraph -->' }
blockComponents={ {
'core/paragraph': MyCoreParagraph,
'core/heading': MyCoreHeading
} }
/>
)
}
Fields
Property | Type | Description |
---|---|---|
postContent | string | The raw Gutenberg Block Editor content, including the HTML comment separators. |
blockComponents | object | An object containing the block name and corresponding components to use for specific blocks. Set the key to match the block name, as defined in the first paramater of registerBlockType when the block was registered with the Block Editor. |