Skip to content

Link Control

Matthew Haines-Young edited this page Dec 7, 2021 · 7 revisions

These control components are intended for use in the advanced block settings UI that appears in the sidebar.

image

The link control is just a wrapper for the core Gutenberg URL input component. The only difference is the visual appearance and API is more aligned with other sidebar controls such as the TextControl.

Usage

const { InspectorControls } = wp.blocks;
const { LinkControl } = hm.controls;
const { attributes, setAttributes } = props;

<InspectorControls>
    <LinkControl
        label="Link"
        help="Some description text"
        value={ attributes.link }
        onChange={ link => setAttributes( { link } ) }
    />
</InspectorControls>
Clone this wiki locally