Skip to content

Group Block: Add a ‘display horizontal’ option #24473

@rickybanister

Description

@rickybanister

When building patterns or trying to achieve a layout with multiple elements arranged horizontally it would help to have a parent block that would automatically arrange its children on a single line. Columns can be used to arrange things side-by-side, but they add quite a lot of extra nesting if you only need to arrange one set of blocks.

We could leverage the Group block and add a ‘display horizontally’ or ‘act as a row’ option to it. It would wrap its children and act as a ‘flex container’ (display:flex; flex-direction:row;). Further flex parameters could be optional to align and distribute objects.

The benefits:

Instead of the complexity and nesting of the first image below, one could achieve a simple horizontal layout like in the second image.

Frame 1

Another benefit would be simplifying the number of areas where a child block could potentially be added.

Frame 2

The width of the block and its contents would work a little different than columns, which have specified percentage widths. The wrapping block itself would be the full width of its container, but its contents will vary. We should embrace that and provide all the alignment/distribution attributes afforded by flex.

Frame 3

Metadata

Metadata

Assignees

Labels

Needs DesignNeeds design efforts.[Block] GroupAffects the Group Block (and row, stack and grid variants)[Feature] ThemesQuestions or issues with incorporating or styling blocks in a theme.[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions