I am constructing an InspectorTools interface for a Gutenberg block. I can not work out tips on how to use the Textual content part. There aren’t actually any examples to be used in javascript.
The web page https://developer.wordpress.org/block-editor/elements/textual content/ it offers this instance:
import {Textual content} from '@wordpress/elements';
const HeroPanel = () => (
<>
<Textual content variant="title.giant" as="h1">Hiya World!</Textual content>
<Textual content variant="physique">Greetings to you!</Textual content>
</>
);
I’ve tried in plenty of methods however I at all times get this error :
Aspect sort is invalid: anticipated a string (for built-in elements)
or a category/operate (for composite elements) however bought: undefined.
Listed here are a number of of my makes an attempt:
createElement(PanelRow, {}, createElement(Textual content, { variant: 'title.small', as: 'h3' }, __('This can be a take a look at', 'my-textdomain')) )
createElement(PanelRow, {}, createElement(Textual content, { as: 'h3' }, __('This can be a take a look at', 'my-textdomain')) )
createElement(PanelRow, {}, createElement(Textual content, { variant: 'title.small' }, __('This can be a take a look at', 'my-textdomain')) )
createElement(PanelRow, {}, createElement(Textual content, __('This can be a take a look at', 'my-textdomain')) )
createElement(PanelRow, {}, createElement(Textual content, {}, __('This can be a take a look at', 'my-textdomain')) )
createElement(PanelRow, {}, createElement(Textual content, { label: __('This can be a take a look at', 'my-textdomain')}) )
None of my makes an attempt have labored, all of them give the identical error.
What could be the proper means to make use of a easy Textual content part?
My goal on this case is to create a label for a ButtonGroup part which, so far as I can inform, would not have a label property (I’ve solely discovered an accessibilityLabel property which is created on the ButtonGroup however which isn’t nevertheless seen on the interface, clearly).