Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d06e41f
Add space-around and space-evenly justification
Sukhendu2002 Aug 8, 2025
fb1e233
feat(block-editor): update justification panel
Sukhendu2002 Sep 24, 2026
b3c69e9
fix(block-editor): contain justification trigger
Sukhendu2002 Sep 24, 2026
eb4346b
fix: show full justification label
Sukhendu2002 Sep 24, 2026
9556a71
feat: support additional flex justification
Sukhendu2002 Sep 24, 2026
080c9d3
Add Core backport for #71129
Sukhendu2002 Sep 24, 2026
88ccb1d
feat: refine flex justification options
Sukhendu2002 Sep 25, 2026
e782ed2
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Sep 28, 2026
1052844
fix: complete flex justification support
Sukhendu2002 Sep 28, 2026
46b0f74
fix: prevent Justification select crash on Stack to Row switch and co…
Sukhendu2002 Oct 14, 2026
b03ed0d
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Oct 14, 2026
c3e0d83
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Oct 14, 2026
2b2d9d3
Merge remote-tracking branch 'upstream/trunk' into add/buttons-block-…
Sukhendu2002 Oct 23, 2026
ad80f85
fix: show icons in flex justification controls
Sukhendu2002 Oct 23, 2026
79fe64f
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Oct 23, 2026
279f5b9
docs: move justification notes to Unreleased
Sukhendu2002 Oct 23, 2026
c532c77
test: migrate justification test to TypeScript
Sukhendu2002 Oct 23, 2026
8982886
Merge remote-tracking branch 'upstream/trunk' into add/buttons-block-…
Sukhendu2002 Nov 3, 2026
db25d85
fix: simplify flex justification controls
Sukhendu2002 Nov 3, 2026
6d185cd
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Nov 3, 2026
1aa584e
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Nov 30, 2026
6746008
fix: move changelog entries to Unreleased
Sukhendu2002 Nov 30, 2026
2d96d7d
fix: restore null check in justification change handler
Sukhendu2002 Nov 30, 2026
2a97734
fix: keep justification when flex orientation changes
Sukhendu2002 Dec 2, 2026
5824b40
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Dec 2, 2026
6653aeb
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into a…
Sukhendu2002 Dec 2, 2026
686f33c
fix: rename Stretch label, align Constrained labels, update nav PHPDoc
Sukhendu2002 Dec 2, 2026
f21db59
fix: use vi.mocked in navigation layout custom properties test
Sukhendu2002 Dec 2, 2026
8463094
Merge branch 'trunk' into add/buttons-block-space-justification-options
Sukhendu2002 Dec 2, 2026
1167f9f
fix: keep the original JustifyContentControl default controls
Sukhendu2002 Dec 3, 2026
14cc42f
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into a…
Sukhendu2002 Dec 3, 2026
3240028
Merge branch 'trunk' into add/buttons-block-space-justification-options
t-hamano Dec 3, 2026
294b094
docs: clarify JustifyContentControl allowedControls and changelog
Sukhendu2002 Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions backport-changelog/7.3/13710.md
Comment thread
Sukhendu2002 marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/13710

* https://github.com/WordPress/gutenberg/pull/71129
2 changes: 2 additions & 0 deletions docs/explanations/architecture/styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ The current semantic class names that can be output by the Layout block support
- `is-content-justification-center`: When a block explicitly sets `justifyContent` to `center`.
- `is-content-justification-right`: When a block explicitly sets `justifyContent` to `right`.
- `is-content-justification-space-between`: When a block explicitly sets `justifyContent` to `space-between`.
- `is-content-justification-space-around`: When a block explicitly sets `justifyContent` to `space-around`.
- `is-content-justification-space-evenly`: When a block explicitly sets `justifyContent` to `space-evenly`.
- `is-nowrap`: When a block explicitly sets `flexWrap` to `nowrap`.

### Opting out of generated layout styles
Expand Down
6 changes: 5 additions & 1 deletion lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,11 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support
);

if ( 'horizontal' === $layout_orientation ) {
$justify_content_options += array( 'space-between' => 'space-between' );
$justify_content_options += array(
'space-between' => 'space-between',
'space-around' => 'space-around',
'space-evenly' => 'space-evenly',
);
$vertical_alignment_options += array( 'stretch' => 'stretch' );
} else {
$justify_content_options += array( 'stretch' => 'stretch' );
Expand Down
5 changes: 5 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### New Features

- Flex layout: Add Space around and Space evenly justification options, using a select control with icons and labels in the Layout panel ([#71129](https://github.com/WordPress/gutenberg/pull/71129)).
Comment thread
Sukhendu2002 marked this conversation as resolved.
Resolved
- `JustifyContentControl`: Support `space-around` and `space-evenly` through `allowedControls` ([#71129](https://github.com/WordPress/gutenberg/pull/71129)).

### Bug Fixes

- List View: Pasting a file without upload permissions no longer replaces the focused block ([#87852](https://github.com/WordPress/gutenberg/pull/87852)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The `JustifyContentControl` component renders a toolbar that displays justify options for the selected block.

This component is used to set the flex justification for the elements in the block, allowing to justify `left`, `center`, `right`, and `space-between`. In comparison, the alignment options are for the block itself.
This component is used to set the flex justification for the elements in the block, allowing to justify `left`, `center`, `right`, `space-between`, `space-around`, and `space-evenly`. In comparison, the alignment options are for the block itself.

See the Navigation block for an example usage.

Expand Down Expand Up @@ -33,6 +33,8 @@ const MyJustifyToolbar = ( { attributes, setAttributes } ) => (
items-justified-center
items-justified-right
items-justified-space-between
items-justified-space-around
items-justified-space-evenly

_Note:_ In this example that we render `JustifyContentControl` as a child of the `BlockControls` component.

Expand All @@ -43,14 +45,14 @@ _Note:_ In this example that we render `JustifyContentControl` as a child of the
- **Type:** `string[]`
- **Default:** `[ 'left', 'center', 'right', 'space-between' ]`

An array of strings for what controls to show, by default it shows all.
An array of strings for what controls to show. Pass `space-around`, `space-evenly`, or `stretch` to show those controls, which are not shown by default.

#### `onChange`

- **Type:** `Function`
Comment thread
Sukhendu2002 marked this conversation as resolved.
Resolved
- **Required:** Yes

A callback function invoked when the toolbar's justification value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `space-between`, `undefined`) as the only argument.
A callback function invoked when the toolbar's justification value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `space-between`, `space-around`, `space-evenly`, `undefined`) as the only argument.

#### `popoverProps`

Expand All @@ -65,7 +67,7 @@ Use this object to modify props available for the `Popover` component that are n

- **Type:** `String`
- **Default:** `undefined`
- **Options:**: `left`, `center`, `right`, `space-between`
- **Options:**: `left`, `center`, `right`, `space-between`, `space-around`, `space-evenly`

The current value of the alignment setting. You may only choose from the `Options` listed above.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@
.items-justified-space-between {
justify-content: space-between;
}

.items-justified-space-around {
justify-content: space-around;
}

.items-justified-space-evenly {
justify-content: space-evenly;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import type { Dropdown } from '@wordpress/components';
* A justification of the items in a block.
*/
export type JustifyContentValue =
'left' | 'center' | 'right' | 'space-between' | 'stretch';
| 'left'
| 'center'
| 'right'
| 'space-between'
| 'space-around'
| 'space-evenly'
| 'stretch';

/**
* Props of `JustifyContentControl` and `JustifyToolbar`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ import {
justifyCenter,
justifyRight,
justifySpaceBetween,
justifySpaceAround,
justifySpaceEvenly,
justifyStretch,
} from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import type { JustifyContentUIProps, JustifyContentValue } from './types';

const icons = {
left: justifyLeft,
center: justifyCenter,
right: justifyRight,
'space-between': justifySpaceBetween,
'space-around': justifySpaceAround,
'space-evenly': justifySpaceEvenly,
stretch: justifyStretch,
};

Expand Down Expand Up @@ -42,35 +46,49 @@ function JustifyContentUI( {
{
name: 'left',
icon: justifyLeft,
title: __( 'Justify items left' ),
title: _x( 'Left', 'Flex layout justification option' ),
isActive: 'left' === value,
onClick: () => handleClick( 'left' ),
},
{
name: 'center',
icon: justifyCenter,
title: __( 'Justify items center' ),
title: _x( 'Center', 'Flex layout justification option' ),
isActive: 'center' === value,
onClick: () => handleClick( 'center' ),
},
{
name: 'right',
icon: justifyRight,
title: __( 'Justify items right' ),
title: _x( 'Right', 'Flex layout justification option' ),
isActive: 'right' === value,
onClick: () => handleClick( 'right' ),
},
{
name: 'space-between',
icon: justifySpaceBetween,
title: __( 'Space between items' ),
title: __( 'Space between' ),
isActive: 'space-between' === value,
onClick: () => handleClick( 'space-between' ),
},
{
name: 'space-around',
icon: justifySpaceAround,
title: __( 'Space around' ),
isActive: 'space-around' === value,
onClick: () => handleClick( 'space-around' ),
},
{
name: 'space-evenly',
icon: justifySpaceEvenly,
title: __( 'Space evenly' ),
isActive: 'space-evenly' === value,
onClick: () => handleClick( 'space-evenly' ),
},
{
name: 'stretch',
icon: justifyStretch,
title: __( 'Stretch items' ),
title: _x( 'Stretch', 'Flex layout justification option' ),
isActive: 'stretch' === value,
onClick: () => handleClick( 'stretch' ),
},
Expand Down
12 changes: 12 additions & 0 deletions packages/block-editor/src/hooks/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@
.layout-block-support-panel {
.block-editor-hooks__flex-layout-controls {
grid-column: 1 / -1;

> * {
min-width: 0;
}

.block-editor-hooks__flex-layout-justification-item {
flex: 1;
}

.block-editor-hooks__flex-layout-orientation-item {
flex: none;
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/block-editor/src/layouts/constrained.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import {
Icon,
alignNone,
Expand Down Expand Up @@ -71,17 +71,17 @@ export default {
{
value: 'left',
icon: justifyLeft,
label: __( 'Justify items left' ),
label: _x( 'Left', 'Flex layout justification option' ),
},
{
value: 'center',
icon: justifyCenter,
label: __( 'Justify items center' ),
label: _x( 'Center', 'Flex layout justification option' ),
},
{
value: 'right',
icon: justifyRight,
label: __( 'Justify items right' ),
label: _x( 'Right', 'Flex layout justification option' ),
},
];
const [ availableUnits ] = useSettings( 'spacing.units' );
Expand Down
Loading
Loading