2.2.0
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.
JSX.Element
:
Component to render.
<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.
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
(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. |
JSX.Element
:
Component to render.
<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.
(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
|
(Object)
Enhancer used to enable passing a ref to its wrapped component.
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
JSX.Element
:
Component to render.
<EditToolbarControl doRender={ ! isPlaceholder } onClick={ togglePlaceholder } />
A wrapper around the WordPress "Notice" component to allow displaying error messages when appropriate.
(Object)
Component properties.
Name | Description |
---|---|
props.children JSX.Element
|
Components to be rendered as content. |
props.otherProps ...any
|
JSX.Element
:
Component to render.
<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.
(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. |
JSX.Element
:
Component to render.
<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.
(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. |
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
JSX.Element
:
The component to be rendered.
<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.
JSX.Element
:
Component to render.
const content = '<span class=\"amount\"><bdi><span class=\"currency-symbol\">£<\/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.
(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. |
JSX.Element
:
Component to render.
<IsRequiredToolbarControl onClick={ () => setAttributes( { isRequired: ! isRequired } ) } value={ isRequired } />
The "Query" component to render queried items.
(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
|
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
JSX.Element
:
Component to render.
<Loading label={ __( 'Loading posts…' ) } />
Media component to represent image or video element depending on the media type being stored within the block attributes.
(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
|
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
(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. |
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<NewPostLink postType="page" />
Display static message to communicate prominent not-found message to the user.
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<TermsTreeSelect
label={ { __( 'Category' ) } }
onChange={ ( value ) => setAttributes( { categories: value } ) }
taxonomy={ 'categories' }
value={ '12' }
/>
Helper component to adjust arguments to query (retrieve) posts.
(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. |
JSX.Element
:
Component to render.
<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.
(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
|
JSX.Element
:
Component to render.
<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.
(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. |
JSX.Element
:
The component to be rendered.
<WidthPanel onChange={ ( value ) => onChange( { width: value } ) } title={ __( 'Width settings' ) } value={ 25 } />