Skip to main content

Interface: BlockProps<BlockAttributes, Context>

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:24

The interface any children of BlocksRenderer must implement.

Type Parameters​

BlockAttributes​

BlockAttributes extends IDataWPBlock = IDataWPBlock

Context​

Context extends BlockContext = BlockContext

Properties​

block?​

optional block: ParsedBlock<BlockAttributes>

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:64

The block's attribute


blockContext?​

optional blockContext: Context

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:81

An optional context that is passed to all children components


children?​

optional children: ReactNode

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:71

The children of the domNode that was replaced with the react component

Note: the children of the domNode are recursively parsed.


classList?​

optional classList: string | string[]

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:54

The class name of the domNode that should be replaced with the react component

If tagName is specified, then classList is mandatory


domNode?​

optional domNode: Element

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:59

The actual domNode that was replaced with the react component


exclude()?​

optional exclude: (childNode, site?) => boolean

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:40

An optional exclude function that also receives a domNode and is executed against every child of the node being replaced with a react component.

This is useful to selectively disregard certain children of a node when replacing with a react component.

Parameters​

childNode​

Element

site?​

HeadlessConfig

Returns​

boolean


style?​

optional style: Record<string, string>

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:76

The style tag of the domNode as an object.


tagName?​

optional tagName: string

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:47

The tag name of the domNode that should be replaced with the react component

If a test function is not supplied, then passing tagName is mandatory


test()?​

optional test: (domNode, site?) => boolean

Defined in: packages/core/src/react/components/BaseBlocksRenderer.tsx:32

A test function receives a domNode and returns a boolean value indicating whether that domNode should be replaced with the React component

Parameters​

domNode​

Element

site?​

HeadlessConfig

Returns​

boolean