Skip to content

Row Block: Add Axial Block Gap Support #47084

Closed

Description

@iamtakashi

If I'm not missing anything obvious, the row block doesn't currently allow "unlink sides" to give different gaps for vertical and horizontal. It'd be great if the block had the axial block gap support like the Social Icons block.

For example, several post meta info is in a row block here. The gap is good for horizontally, but the same gap is too much for vertically.

Screenshot 2023-01-11 at 18 27 19

If the row block has the axial block gap support, I will give much small gap vertically. Something like...

Screenshot 2023-01-11 at 18 30 28

Activity

  1. richtabor commented on Jan 11, 2023

    @richtabor
    Member

    I played around with it locally; I'm actually not so sure about the necessity of X and Y block gap support in the row/group blocks. Unless I'm mistaken, the only reason you'd need Y spacing in the row block, is if the blocks were set to wrap multiple lines (screenshot below) and you want a different X and Y — otherwise, the Y value would never be applied.

    We'd want to tie the axial logic to whether or not the blocks are set to wrap — and I'm not sure about that.

    In the case above, you could probably have a parent group block, with a row block for the author, date and categories, then the tags block after that. The parent group block gap would set the Y space, and the row block would set the X space.

    CleanShot 2023-01-11 at 16 18 29@2x

  2. added
    [Block] Group
    [Type] Enhancement
    on Jan 11, 2023
  3. iamtakashi commented on Jan 11, 2023

    @iamtakashi
    Author

    Thanks, @richtabor. The suggestion wouldn't entirely prevent the situation because the category list can also be on the second line if the viewport is small.

    I think I get the hesitation to introduce an option tied to one of the layout options now behind the tab. However, the pattern with all the post meta in a row block isn't uncommon to see, and it makes sense to me to allow theme designers to fine-tune the row block with the axial block gap support.

  4. richtabor commented on Jan 11, 2023

    @richtabor
    Member

    @iamtakashi Do you mind pasting the block markup you're using here? I'd like to get a sense of exactly how you're implementing this.

  5. iamtakashi commented on Jan 12, 2023

    @iamtakashi
    Author

    @richtabor Sure. The part of the markup is like this. In the theme I'm working on, the part is inside a narrow column, but that doesn't matter for this discussion. Having a few categories and tags and narrowing the viewport would help illustrate my situation.

    <!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|30"}},"layout":{"type":"flex"}} -->
    <div class="wp-block-group">
    	<!-- wp:post-date {"isLink":false} /-->
    	<!-- wp:post-author {"showAvatar":false,"isLink":true} /-->
    	<!-- wp:post-terms {"term":"category"} /-->
    	<!-- wp:post-terms {"term":"post_tag"} /-->
    </div>
    <!-- /wp:group -->
    

    The pattern appears with TT3 like this.

    Screenshot 2023-01-12 at 12 06 04

    If I apply the suggestion, this will be the outcome when the viewport is narrow. Notice the category list is on the second line and the unwanted vertical gap.

    Screenshot 2023-01-12 at 12 09 27

  6. ndiego commented on Jan 17, 2023

    @ndiego
    Member

    I have found the need for vertical blockGap in a few patterns I was experimenting with recently. But Rich is correct in that it only applies when Rows are wrapped.

  7. t-hamano commented on Feb 4, 2023

    @t-hamano
    Contributor

    This issue may be a bit complicated.

    Currently, the Gallery block and Social Links block support axial block gap support, but these two blocks are defined to have only flex layout type.

    However, the group block has constrained and flex layouts. For the constrained layout (default group), axial block gap should not be supported, but I think the current blockGap UI doesn't take the layout type into account.

    cc @andrewserong Because we recently discussed blockGap support in #47518.

  8. added
    [Feature] Layout
    on Feb 5, 2023
  9. andrewserong commented on Feb 5, 2023

    @andrewserong
    Contributor

    Thanks for the ping @t-hamano!

    For the constrained layout (default group), axial block gap should not be supported, but I think the current blockGap UI doesn't take the layout type into account.

    That's correct. The issue is further complicated a bit in that because Row and Stack are variations of Group, when we apply block spacing in global styles, we can't target a particular variation. I think one path forward would be to make both the blockGap UI and the style output aware of the layout type when supporting axial sides. That should be do-able, but it does add a little more complexity to solve the problem.

    It would probably also be a good thing to implement so that axial directions can be supported for future layout types (like Grid) as yet another Group block variation. So it'd be good thing to solve for in the long-term. CC: @tellthemachines just for visibility as we've discussed the idea of a Grid layout type and the group block's variations lately.

  10. webmandesign commented on Aug 2, 2023

    @webmandesign
    Contributor

    +1 from me. (As from #53255.)

    It would be awesome if this was implemented somehow. Having vertical gap control for Rows with enabled wrapping allows us applying more precise responsive design.

    For example, I use a Row in my theme's header with quite generous horizontal gap, but on mobile devices I'd prefer to have much smaller vertical gap between wrapped inner blocks.

  11. JiveDig commented on Dec 19, 2024

    @JiveDig

    +1. Bumping this for the same reasons. When a navigation menu, post meta, etc., wraps the vertical spacing can be too much. We also often have a grid of rows/columns and want the row gap larger than the column gap.

  12. added
    [Feature] Design Tools
    on Dec 5, 2025
  13. hanneslsm commented on Jul 10, 2026

    @hanneslsm

    Third time I'm running into this issue, so it's still relevant when building themes.
    I'd also like to use a smaller vertical gap than horizontal gap in some layouts.

    Could we somehow support two values for presets used as block gap? This would let us keeping a single gap preset instead of having separate vertical and horizontal values in the UI, and the spacing is defined by the theme.

    CSS already supports two values for gap:

    gap: 0.75rem 1rem;
  14. webmandesign commented on Jul 11, 2026

    @webmandesign
    Contributor

    Hi @hanneslsm,

    I deal with this issue by modifying Group (Row) block supports where I enable both vertical and horizontal gap setup. Here is a code you can use in your theme's functions.php file:

    add_action( 'enqueue_block_editor_assets', function() {
    
    	$handle = 'my-block-mods';
    
    	wp_register_script(
    		$handle,
    		'',
    		array(
    			'wp-blocks',
    			'wp-hooks',
    			'lodash',
    		),
    		false,
    		true
    	);
    	wp_enqueue_script( $handle );
    
    	wp_add_inline_script(
    		$handle,
    		"wp.hooks.addFilter(
    			'blocks.registerBlockType',
    			'my-block-mods',
    			( settings, name ) => {
    
    				if ( 'core/group' === name ) {
    					settings = lodash.merge( settings, {
    						supports: {
    							spacing: {
    								blockGap: {
    									sides: [
    										'horizontal',
    										'vertical'
    									]
    								}
    							}
    						}
    					} );
    				}
    
    				return settings;
    			},
    			5
    		);"
    	);
    } );
  15. added
    [Status] In Progress
    on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Block] Group[Feature] Design Tools[Feature] Layout[Status] In Progress[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions