diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md
index c639ee59422cd..4e85dbaf89fd9 100644
--- a/packages/block-editor/CHANGELOG.md
+++ b/packages/block-editor/CHANGELOG.md
@@ -14,6 +14,7 @@
- `URLInput`: the `renderSuggestions` callback prop now receives `currentInputValue` as a new parameter ([45806](https://github.com/WordPress/gutenberg/pull/45806)).
- Fluid typography: add configurable fluid typography settings for minimum font size to theme.json ([#42489](https://github.com/WordPress/gutenberg/pull/42489)).
+- `URLInput`: Add `__nextHasNoMarginBottom` prop for opting into the new margin-free styles ([46692](https://github.com/WordPress/gutenberg/pull/46692)).
### Bug Fix
diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js
index 95c925a45d830..f38ae4384f1cf 100644
--- a/packages/block-editor/src/components/link-control/search-input.js
+++ b/packages/block-editor/src/components/link-control/search-input.js
@@ -126,6 +126,7 @@ const LinkControlSearchInput = forwardRef(
return (
setAttributes( { url, text: (post && post.title) || 'Click here' } ) }
diff --git a/packages/block-editor/src/components/url-input/button.js b/packages/block-editor/src/components/url-input/button.js
index 6ee6b96f61e0e..fca054993e7c3 100644
--- a/packages/block-editor/src/components/url-input/button.js
+++ b/packages/block-editor/src/components/url-input/button.js
@@ -57,6 +57,7 @@ class URLInputButton extends Component {
onClick={ this.toggle }
/>
diff --git a/packages/block-editor/src/components/url-input/index.js b/packages/block-editor/src/components/url-input/index.js
index 0eb97730e15d1..758c3bf51bec3 100644
--- a/packages/block-editor/src/components/url-input/index.js
+++ b/packages/block-editor/src/components/url-input/index.js
@@ -7,6 +7,7 @@ import scrollIntoView from 'dom-scroll-into-view';
/**
* WordPress dependencies
*/
+import deprecated from '@wordpress/deprecated';
import { __, sprintf, _n } from '@wordpress/i18n';
import { Component, createRef } from '@wordpress/element';
import { UP, DOWN, ENTER, TAB } from '@wordpress/keycodes';
@@ -424,6 +425,8 @@ class URLInput extends Component {
renderControl() {
const {
+ /** Start opting into the new margin-free styles that will become the default in a future version. */
+ __nextHasNoMarginBottom = false,
label = null,
className,
isFullWidth,
@@ -477,8 +480,19 @@ class URLInput extends Component {
return renderControl( controlProps, inputProps, loading );
}
+ if ( ! __nextHasNoMarginBottom ) {
+ deprecated( 'Bottom margin styles for wp.blockEditor.URLInput', {
+ since: '6.2',
+ version: '6.5',
+ hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version',
+ } );
+ }
+
return (
-
+
{ loading && }
diff --git a/packages/block-editor/src/components/url-popover/link-editor.js b/packages/block-editor/src/components/url-popover/link-editor.js
index cf783b6875b0a..b0502fbb2a402 100644
--- a/packages/block-editor/src/components/url-popover/link-editor.js
+++ b/packages/block-editor/src/components/url-popover/link-editor.js
@@ -31,6 +31,7 @@ export default function LinkEditor( {
{ ...props }
>
setAttributes( { url: nextURL } )