What’s the recommended Gutenberg component for adding a URL, in the toolbar/sidebar?

UrlInput uses LinkControl internally, but neither have been built with the sidebar in mind, they’re to be used inside popover components that appear inline such as when a toolbar button is clicked.

They aren’t intended to appear directly in toolbars either. Most if not all input components can’t be shown in the toolbar, with the exception of buttons for obvious reasons.

If using this component causes overflow in the sidebar, then you need to report this as a bug in the Gutenberg Github issues as soon as possible so that it can be fixed.

Otherwise this is the closest you will find currently to a canonical post/URL selection input. I suggest for the moment that you print the URL value and show an edit button next to it that triggers a popover component containing the link control

Leave a Comment