diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 57820884bb20da..e0e9590d998c39 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -473,6 +473,21 @@ _Returns_ - `string`: returns the cssUnit value in a simple px format. +### HtmlElementControl + +Control for selecting the block tagname. + +_Parameters_ + +- _props_ `Object`: Component props. +- _props.onChange_ `Function`: Callback to handle onChange. +- _props.options_ `Object`: Tagnames to be used in the select control. +- _props.value_ `string`: Selected tag value. + +_Returns_ + +- `WPElement`: Control for selecting the block tagname. + ### InnerBlocks _Related_ diff --git a/packages/block-editor/src/components/html-element/README.MD b/packages/block-editor/src/components/html-element/README.MD new file mode 100644 index 00000000000000..ed4be3faf0ee6d --- /dev/null +++ b/packages/block-editor/src/components/html-element/README.MD @@ -0,0 +1,68 @@ +# HtmlElementControl + +Allow users to select the HTML tag used by the block. + +## Usage + +```jsx +import { HtmlElementControl } from '@wordpress/block-editor'; + +const Example = () => ( + + setAttributes( { tagName: value } ) + } + /> +); +``` + +## Props + +The component accepts the following props: + +### options + +An array of tag names and labels. Should be of the format: + +```js +[ + { label: __( 'Default (
)' ), value: 'div' }, + { label: '
', value: 'header' }, + ... +] +``` + +If not provided, the default selection of tags are shown. + +- Type: `Array` +- Required: No + +Default: + +```js +[ + { label: '
', value: 'div' }, + { label: '
', value: 'header' }, + { label: '
', value: 'main' }, + { label: '
', value: 'section' }, + { label: '
', value: 'article' }, + { label: '