-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: Deprecate outer margins #39358
Comments
WP 6.7 decided to flood the browser console with deprecation warnings for a good portion of the most used components. This means to clear the console you must. - Opt into no margin - Provide your own margin handling for bottom margins. Hopefully one day we can revert this!! WordPress/gutenberg#39358
I'm the developer of a plugin that uses several of these components in a Gutenberg block. What is the proper way of using a component with some margin at the bottom? Should I add a class to the components, or add a wrapper, or something else? |
@Ugoku Good question! We are in a somewhat transitional state right now, so most components injected into the Block Inspector will continue to have an automatic bottom margin (see #65191 for context). Otherwise, feel free to do whatever makes sense for your use case — put them in a flexbox wrapper div with |
Thanks for your reply @mirka ! If here's no preferred way, I will have a look to see what best suits us. |
What problem does this address?
A lot of components currently have inherent outer margins, making it hard to reuse in different contexts since it requires a style override (often of an internal element). This kind of style override is something we want to discourage.
What is your proposed solution?
Deprecate the bottom margin (similar to #37160), following the guidelines stipulated in the devdocs.
Components
Each component first needs a
__nextHasNoMarginBottom
prop to opt in, and then they also need to be officially deprecated after all in-repo usage has been migrated.duotonePalette={ [] }
andunsetable={ false }
)Block Editor Components
NumberControl
on Style options. #37160(Component lists may not be exhaustive, please add)
✍️ Dev Note (WordPress 6.7 release)
Bottom margin styles are deprecated
A number of UI components currently ship with styles that give them bottom margins. This can make it hard to reuse them in arbitrary layouts, where you want different amounts of gap or margin between components.
To better suit modern layout needs, we have gradually been deprecating these margins. A deprecation begins with an opt-in period where you can choose to apply the new margin-free styles on a given component instance. Eventually in a future version, the margins will be completely removed.
Continuing the effort started in previous releases, for the WordPress 6.7 release we will start logging deprecation warnings for the following components if they are not yet opting into the new margin-free styles:
BaseControl
CheckboxControl
ComboboxControl
DimensionControl
FocalPointPicker
FormTokenField
RangeControl
SearchControl
SelectControl
TextControl
TextareaControl
ToggleControl
ToggleGroupControl
TreeSelect
To start opting into the new margin-free styles, set the
__nextHasNoMarginBottom
prop totrue
.The text was updated successfully, but these errors were encountered: