A wrapper component around the "Button" component provided by the core.

This component has been created to represent adding items into a list with consideration for ease of styling and following D.R.Y principle.

AddButton(props: Object): JSX.Element
Since: 1.2.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.onClick Function Callback function for processing click events on the button component.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<AddButton onClick={ handleOnClickAdd } />

A wrapper component around the "AlignmentControl" component provided by the core.

This component renders a toolbar of alignment icon buttons. This is useful for block-level modifications to be made available when a block is selected.

AlignmentToolbarControl(props: Object): JSX.Element
Since: 2.2.0
Parameters
props (Object) Component properties.
Name Description
props.group string Block toolbar group name.
props.onChange Function Callback function for processing click events on the toolbar button component.
props.value string Toolbar button title as the tooltip.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<AlignmentToolbarControl
    doRender
    onChange={ ( value ) => setAttributes( { textAlign: value } ) }
	   value={ textAlign }
/>

This component renders a custom color selector, which makes it easy to create, adjust, and experiment with theme colors.

ColorPicker(props: Object): JSX.Element
Since: 2.1.1
Parameters
props (Object) Component properties.
Name Description
props.context string Context/place where color is being used e.g: background, link, text.
props.help string A small help text displayed below the color select element.
props.instanceId string A unique id for each instance of this component.
props.label string Label property as the content.
props.onChange Function Callback called when a color is selected.
props.value string Selected color hex value.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<ColorPicker
    context="background"
    label={ __( 'Background' ) }
    onChange={ ( value ) => setAttributes( { color: value } ) }
    value={ "#FFFFFF" }
/>

// => Object { color: "#ff5252", name: "Primary", slug: "primary", className: "has-background has-primary-background-color" }

React component for wrapping children based on a condition.

ConditionalWrap(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.condition boolean Whether the component should be wrapped.
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.wrap Function Callback function to clone and return a new React element using element as the starting point.
Returns
JSX.Element: Component to render.
Example
<ConditionalWrap
    condition={ !! tooltip }
    wrap={ ( children ) => (
         <Tooltip position="bottom" title={ tooltip }>
              { children }
         </Tooltip>
    ) }
>
    <button>{ children }</button>
</ConditionalWrap>

Disabled is a component which disables descendant tabbable elements and prevents pointer interaction.

Disabled(props: Object, ref: Object): JSX.Element
Since: 1.7.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.tagName string The tag name of the editable element. Default: "div".
props.otherProps ...any
ref (Object) Enhancer used to enable passing a ref to its wrapped component.
Returns
JSX.Element: Component to render.
Example
<Disabled tagName="li">
    <a href="https://www.example.com">{ children }</a>
</Disabled>

A wrapper component around the "RichText" component provided by the core.

RichText is a component that allows developers to render a contenteditable input, providing users with the option to format block content to make it bold, italics, linked, or use other formatting.

EditableText(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.className string The CSS class name(s) that will be added to the component element.
props.isSave boolean Whether the field is meant to be rendered on the front-end.
props.onChange Function Function that receives the value of the input.
props.onFocus Function Function that is called when the element receives focus.
props.value string Title property as the content.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<EditableText
    className={ `${ className }__title` }
    doRender={ elements?.title }
    onChange={ ( value ) => setAttributes( { title: value } ) }
    placeholder={ __( 'Title…' ) }
    tagName="h3"
    value={ title }
/>

Toolbar button component used to demonstrate "Edit" action.

EditToolbarControl(props: Object): JSX.Element
Since: 1.9.0
Parameters
props (Object) Component properties.
Name Description
props.group string Block toolbar group name.
props.onClick Function Callback function for processing click events on the toolbar button component.
props.title string Toolbar button title as the tooltip.
Returns
JSX.Element: Component to render.
Example
<EditToolbarControl doRender={ ! isPlaceholder } onClick={ togglePlaceholder } />

A wrapper around the WordPress "Notice" component to allow displaying error messages when appropriate.

ErrorMessage(props: Object): JSX.Element
Since: 1.2.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Components to be rendered as content.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<ErrorMessage>
    __( 'Entered address is not a valid email address!' )
</ErrorMessage>

Email text-input component that lets users input a number of email addresses and provides a layer of validation against any possible invalid data entered.

EmailControl(props: Object): JSX.Element
Since: 1.3.0
Parameters
props (Object) Component properties.
Name Description
props.help string A small help text displayed below the input field.
props.label string Label property as the content.
props.onChange Function A callback function invoked when any of the values change.
props.otherErrorMessageProps Object Additional properties passed to the "TextControl" component.
props.otherTextControlProps Object Additional properties passed to the "ErrorMessage" component.
props.placeholder string Text shown as a hint to the user as to what kind of information is expected.
props.value string The current value of the input.
props.withError boolean Whether to output validation error message below the field.
Returns
JSX.Element: Component to render.
Example
<EmailControl onChange={ ( value ) => onChange( { to: value } ) } />

This component provides a set of UI buttons that allows users to open and interact with the WordPress media library. This placeholder component could make it possible to provide an integration with the core blocks that handle media files.

GalleryUpload(props: Object): JSX.Element
Since: 1.6.0
Parameters
props (Object) Component properties.
Name Description
props.instanceId string A unique id for each instance of this component.
props.isSelected boolean Whether or not this element is currently selected.
props.messages Object Labels and notices for subcomponents. Merges user defined values into defaults.
props.noticeOperations Object A number of functions to add notices to the editor.
props.noticeUI (boolean | JSX.Element) The rendered NoticeList.
props.onChange Function Function that receives the value of the media control.
props.sizeSlug string The currently-selected image size slug (thumbnail, large, etc).
props.value Array Gallery images.
props.withFileUpload boolean Whether to render an additional button to upload extra images to the gallery.
Returns
JSX.Element: Component to render.
Example
<GalleryUpload
    isSelected={ isSelected }
    onChange={ ( value ) => { setAttributes( { images: value } ); } }
    sizeSlug="large"
    value={ images }
/>

// => Array [ { alt: '', caption: '', id: "21", url: 'http://dev.local/wp-content/uploads/2022/09/image.jpg' } ]

The "HtmlAttrs" component allows creating a set of HTML attributes to be added to the wrapper tag of another block instance.

HtmlAttrs(props: Object): JSX.Element
Since: 1.2.2
Parameters
props (Object) Component properties.
Name Description
props.instanceId string A unique id for each instance of this component.
props.onChange Function A callback function invoked when any of the values change.
props.otherAddButtonProps Object Additional properties passed to the "AddButton" component.
props.otherNameProps Object Additional properties passed to the "TextInput -> Name (Key)" field.
props.otherRemoveButtonProps Object Additional properties passed to the "TextInput -> Value" field.
props.otherValueProps Object Additional properties passed to the "RemoveButton" component.
props.value string A JSON string formatted of the current value of inputs.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<HtmlAttrs onChange={ ( value ) => setAttributes( { attrs: value } ) } value={ attrs } />

A drop-in component replaces the SVG element by adding the required accessibility attributes for SVG elements across browsers.

Icon(props: Object): JSX.Element
Since: 1.4.0
Parameters
props (Object) Component properties.
Name Description
props.d string The "d" attribute defines a path to be drawn.
props.otherPathProps Object Additional properties to be added to the "Path" component.
props.otherProps ...any
Returns
JSX.Element: The component to be rendered.
Example
<Icon d="M4 9h16v2H4V9zm0 4h10v2H4v-2z" />

Component used as equivalent of Fragment with unescaped HTML, in cases where it is desirable to render dangerous HTML without needing a wrapper element.

To preserve additional props, a div wrapper will be created if any props aside from children are passed.

InnerHTML(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.tagName string The tag name of the wrapper element.
props.props ...any
Returns
JSX.Element: Component to render.
Example
const content = '<span class=\"amount\"><bdi><span class=\"currency-symbol\">&pound;<\/span>11.05<\/bdi><\/span>';
<InnerHTML tagName="span">{ content }</InnerHTML>

A Boolean attribute indicating that an option with a non-empty string value must be entered/selected.

IsRequiredToolbarControl(props: Object): JSX.Element
Since: 1.4.1
Parameters
props (Object) Component properties.
Name Description
props.group string Block toolbar group name.
props.label string Label property as the tooltip.
props.onClick Function Callback function for processing click events on the button component.
props.value boolean The current state of the button to be active or inactive.
Returns
JSX.Element: Component to render.
Example
<IsRequiredToolbarControl onClick={ () => setAttributes( { isRequired: ! isRequired } ) } value={ isRequired } />

The "Query" component to render queried items.

Query(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.Component Function Reference to the Component to render.
props.havePosts boolean Determines whether current query has posts to loop over.
props.isLoading boolean Whether the query items are being fetched at the moment.
props.otherLoadingProps Object Additional properties passed to the "Loading" component.
props.otherNotFoundProps Object Additional properties passed to the "NotFound" component.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<Query
    className={ className }
    Component={ Loop }
    doRender
    havePosts={ havePosts }
    isLoading={ isLoading }
    query={ slicedQuery }
/>

This component renders an array of given posts, and allows users to select one post from a set.

ListRadioSelect(props: Object): JSX.Element
Since: 1.8.0
Parameters
props (Object) Component properties.
Name Description
props.help string A small help text displayed below the input field.
props.instanceId string A unique id for each instance of this component.
props.isLoading string Whether the query items are being fetched at the moment.
props.label string Label property as the content.
props.onChange Function Callback function to be triggered when the selected radio-option changes.
props.options Array Set of "{ label, value }" pairs that can be selected.
props.value string Selected post id.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<ListRadioSelect
    isLoading={ isLoading }
    onChange={ ( postId ) => setAttributes( { postId } ) }
    options={ [ { value: 100, label: 'My blog post' }, { value: 108, label: 'My other blog post' } ] }
    value={ "100" }
/>

// => String "100"

Spinners notify users that their action is being processed.

Loading(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.label string Label shown before the spinner.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<Loading label={ __( 'Loading posts…' ) } />

Media component to represent image or video element depending on the media type being stored within the block attributes.

Media(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.alt string Alternative text description of the image.
props.className string The CSS class name(s) that will be added to the component element.
props.id number ID of selected or stored media element.
props.mediaType string Media type such as Image or Video file type.
props.url string Path to the image or video file.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<Media
    className={ `${ className }__media` }
    id={ id }
    mediaType={ mediaType }
    url={ url }
/>

Sortable component designed to provide the ability to provide a set of higher-order components to turn any collection of elements given into an accessible and touch-friendly sortable list.

Sortable(props: Object): JSX.Element
Since: 1.2.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.instanceId string Unique ID of the current component instance.
props.onChange Function Callback function to be triggered when the user finishes a sorting gesture.
props.withSortableKnob boolean Whether the item should be allowed to only be draggable from a specific (knob) handle.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<Sortable
    onChange={ ( value ) => setAttributes( { items: value } ) }
>
    { map( items, ( { value, label }, index ) => (
         <Element key={ value } label={ label } value={ value } onRemove={ () => onRemove( index ) } />
    ) ) }
</Sortable>

MultiSelect component designed to provide the ability to search for and select any number of options from a set of "{ label, value }" pairs in any order.

MultiSelect(props: Object): JSX.Element
Since: 1.7.1
Parameters
props (Object) Component properties.
Name Description
props.help string A small help text displayed below the input field.
props.instanceId string A unique id for each instance of this component.
props.isClearable boolean Is the select value clearable.
props.isSearchable boolean Whether to enable search functionality.
props.label string Label property as the content.
props.messages Object Labels and notices for subcomponents. Merges user defined values into defaults.
props.onChange Function Callback function to be triggered when the selected options change.
props.options Array Set of "{ label, value }" pairs that can be selected.
props.value Array List of values of the options that are currently selected.
props.withSelectAll boolean Enable "Select All" checkbox option.
Returns
JSX.Element: Component to render.
Example
<MultiSelect
    options={ [ { value: 100, label: 'My blog post' }, { value: 108, label: 'My other blog post' } ] }
    onChange={ ( value ) => { setAttributes( { ids: value } ); } }
    value={ ids }
/>

// => Array [ 100, 108 ]

A wrapper component around the "Button" component provided by the core.

This component has been created to represent creating a new post-type post with consideration for ease of styling and following D.R.Y principle.

NewPostLink(props: Object): JSX.Element
Since: 2.0.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.errorMessage string Error message displayed when the current user doesn’t have enough permission to create new posts.
props.postType string The post type. Default "post".
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<NewPostLink postType="page" />

Display static message to communicate prominent not-found message to the user.

NotFound(props: Object): JSX.Element
Since: 1.0.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Components to be rendered as content.
props.label string The displayed message of a notice.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<NotFound status="error">
    __( 'Nothing is here to display!' )
</NotFound>

Pill element with a remove button. This component is typically used as the output when iterating over a collection of items that should be displayed as pills/tags rather than standalone.

Pill(props: Object): JSX.Element
Since: 1.7.1
Parameters
props (Object) Component properties.
Name Description
props.label string Label shown in the element.
props.onClick Function Callback function for processing click events on the button component.
props.otherButtonProps Object Additional properties passed to the "Button" component.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<Pill
    label={ label }
    onClick={ handleOnClickPill }
/>

Renders a component is used to generate select input fields with interface to select the parent page/term in a hierarchy of pages/terms.

TermsTreeSelect(props: Object): JSX.Element
Since: 1.1.0
Parameters
props (Object) Component properties.
Name Description
props.label string Label property as the content.
props.noOptionLabel string Label to represent empty selection.
props.onChange Function Function that receives the value of the input.
props.taxonomy string Taxonomy name that the term is part of.
props.value string Link object value for the button component.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<TermsTreeSelect
    label={ { __( 'Category' ) } }
    onChange={ ( value ) => setAttributes( { categories: value } ) }
    taxonomy={ 'categories' }
    value={ '12' }
/>

Helper component to adjust arguments to query (retrieve) posts.

QueryControls(props: Object): JSX.Element
Since: 1.1.0
Parameters
props (Object) Component properties.
Name Description
props.maxItems number Maximum number of items.
props.minItems number Minimum number of items.
props.numberOfItems number The selected number of items to retrieve via the query.
props.onNumberOfItemsChange Function A function that receives the new number of items value.
props.onOrderChange Function A function that receives the new order value.
props.onOrderByChange Function A function that receives the new orderby value.
props.onTermChange Function A function that receives the new term (category) value.
props.order string The order in which to retrieve posts.
props.orderBy string The meta key by which to order posts.
props.otherOrderProps Object Additional properties to be added to the "Order" control.
props.otherTermsTreeSelectProps Object Additional properties to be added to the "Term" dropdown control.
props.otherNumberOfItemsProps Object Additional properties to be added to the "Number of items" (Range) control.
props.selectedTermId string The selected term (category) id.
props.taxonomy string Taxonomy (term) name.
Returns
JSX.Element: Component to render.
Example
<QueryControls
    maxItems={ maxLimit }
    numberOfItems={ limit }
    order={ order }
    orderBy={ orderby }
    onNumberOfItemsChange={ ( value ) => setAttributes( { limit: value } ) }
    onOrderByChange={ ( value ) => setAttributes( { orderby: value } ) }
    onOrderChange={ ( value ) => setAttributes( { order: value } ) }
/>

A wrapper component around the "Button" component provided by the core.

This component has been created to represent removing items from a list with consideration for ease of styling and following D.R.Y principle.

RemoveButton(props: Object): JSX.Element
Since: 1.2.0
Parameters
props (Object) Component properties.
Name Description
props.children JSX.Element Any React element or elements can be passed as children. They will be rendered within the wrapper.
props.onClick Function Callback function to for processing click events on the button component.
props.otherProps ...any
Returns
JSX.Element: Component to render.
Example
<RemoveButton onClick={ handleOnClickRemove } />

A group component that creates a list of "Width" options to choose from. It can also coordinate the checked state of multiple Button components.

WidthPanel(props: Object): JSX.Element
Since: 1.6.2
Parameters
props (Object) Component properties.
Name Description
props.ariaLabel string A string value that labels the "ButtonGroup" interactive component.
props.help string A help text will be generated using help property as the content.
props.instanceId string A unique id for each instance of this component.
props.onChange Function A callback function invoked when any of the values change.
props.range Array List of options to adjust the width of the field.
props.title string Title of the panel. This shows even when it is closed.
props.value number The current width of the field/element.
Returns
JSX.Element: The component to be rendered.
Example
<WidthPanel onChange={ ( value ) => onChange( { width: value } ) } title={ __( 'Width settings' ) } value={ 25 } />