Skip to content
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

Add alignment controls to grid layout #62895

Open
tellthemachines opened this issue Jun 27, 2024 · 5 comments
Open

Add alignment controls to grid layout #62895

tellthemachines opened this issue Jun 27, 2024 · 5 comments
Labels
[Feature] Layout Layout block support, its UI controls, and style output. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.

Comments

@tellthemachines
Copy link
Contributor

Flex layouts such as used in Row and Stack blocks come with justification and alignment options for their content:

Screenshot 2024-06-27 at 11 59 21 AM

It would be good if Grid had something similar. The implementation should be very much like flex, the main thing I guess is to determine whether they should be toolbar or sidebar controls (flex is a bit awkward right now in that it has a mix of both).

Cc @luminuu who asked about this in a hallway hangout. Feel free to add to the issue if I left anything out!

@tellthemachines tellthemachines added [Type] Enhancement A suggestion for improvement. [Feature] Layout Layout block support, its UI controls, and style output. labels Jun 27, 2024
@luminuu
Copy link
Member

luminuu commented Jul 1, 2024

Thanks for opening the issue! I think this has to be separted into two parts: aligning the contents of the grid with justify-items and align-items, as well as aligning the rows and columns of the grid with justify-content and align-content.

To go even further, I think it should also be discussed if a child element can be positioned separately with justify-self and align-self.

@tellthemachines
Copy link
Contributor Author

as well as aligning the rows and columns of the grid with justify-content and align-content

I don't think justify-content will work with our current grid setup, because in both manual and auto the grid tracks occupy the full width of their container. align-content could be used in conjunction with min-height on a Grid block, but I'm not sure there's a use case for it that wouldn't also be covered by separating gap controls to be able to set vertical and horizontal gap to different values, or using padding. Did you have any specific designs in mind?

I think it should also be discussed if a child element can be positioned separately with justify-self and align-self.

This I think would be useful and worth looking into! It could be added to the child controls.

@tellthemachines
Copy link
Contributor Author

@WordPress/gutenberg-design would you folks be able to help with design for these controls? We're looking at:

  • For blocks with Grid layout: justification and alignment controls, similar to the Flex layout ones (can we just reuse those? Will the layout panel look too busy with these in addition to the current Grid controls? It might be time to look into LayoutPanel: Switch to using the ToolsPanel #44560)

  • For child blocks of a Grid layout: self-justification and self-alignment controls. I think it would make sense for these to be close to the current child layout controls (Column and Row span for Grids) but semantically it's weird to have justification and alignment under Dimensions. This means it's probably time to give consideration to something like Unify layout-related controls under the same panel #47902.

@richtabor
Copy link
Member

I don’t think we should not wait on #44560 or #47902.

Could the matrix potentially work here, in the toolbar? As a way to change justification and align together.

@jasmussen
Copy link
Contributor

The missing piece in the matrix is the space-between properties, though perhaps we can still start with just the basic matrix without space-between, because space-between is both complex (therefore secondary and possibly a thing for the inspector), and could potentially be built into the block spacing control itself, to benefit both grid and flex based blocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.
Projects
Status: Now
Development

No branches or pull requests

4 participants