-
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
Block Library: Column: Add predefined "layout" selections for new Columns block #15663
Comments
👋 I created a handful of icons for these sorts of templates, in both 48px and 24px sizes: Here they are for when we're ready to try them out: The Figma file is here: I'm working on some comps to think through this flow, and will post later today. |
Alright, I'm back. 🙂 CoBlocks has users make two choices up front: number of columns and layout. For our placeholder state, I wondered if we can delay the distinction between those until after the block is set up. This way, we can surface a handful of common options up front, and we can get folks into the block quicker: Once the block is setup, users would be able to adjust the column count and layout in the sidebar. When they adjust the number of columns, the layout options would refresh to match: |
I think it's an important distinction from the implementation perspective as well, whether we need to anticipate support for multi-step wizards, or if it's enough to expect that there'd always be at most one step in choosing a predefined layout option for a block. |
This is a crucial feature that I think is missing in core. I don't think it's a good idea to use a third party plugin to support this feature. It makes more sense to provide a basic set of non-equal widths, but then provide hooks which allows theme developers to specify their own layouts (with icons?). And then it'd all be added as a custom class (kinda like how block styles are are implemented), allowing designers to easily override the styles. Who is the best person to speak to regarding this and whether it's something that is willing to be added? |
@codebymikey There are a number of Columns enhancements related to resizing (including this one) already opened as issues. These would be the best place for implementation discussion. You may also plan to join one of the upcoming weekly editor chats. Resizable columns is already available in the plugin as of #15499 (Gutenberg 5.7). |
Thanks @aduth, and yeah I noticed the resizable block feature. I liked that it provided a solution for a problem I had, but I think it could be UX could be improved even further, as I don't think it's current implementation is the most user-friendly/flexible (e.g. I would expect all the settings to be inside the Columns block rather than having to select a specific child Column). I would generally avoid inline styles in blocks when possible and implement everything using classes. Giving all editors the ability to set arbitrary widths is just asking for trouble design-wise, and I'd like to avoid that if possible. It would be easier if the theme developer could specify what types of column layouts they wanted to support, and then the appropriate classes were applied and the CSS rules handled the rest. I'm currently working around this inline attributes issue by creating a custom I followed the editor chat link but couldn't find any info on where the Gutenberg talks took place. |
This is even more true because, due to the simplistic "flex-basis:33.33%" style used, the columns don't take the margin into account and thus don't align properly. |
Thanks @richtabor! For columns that might make sense, however this "patterns" section will be a reusable component, and will likely be applied to blocks that do already have block styles too. For that reason, I don't think it makes sense to mix them in there. I'm starting to think through how that might work over here, and would love your thoughts once I have some comps posted up: #16283 |
I'd like to +1 @codebymikey and @philbraun's comments above. Adding really flexible controls is awesome for some use cases but also makes it hard to enforce project design standards. For example, I'm currently building a Gutenberg-based project which always uses
What's the rationale for moving from classes to inline styles? Thanks in advance. |
Just thinking aloud, but perhaps the patterns can be filtered theme-side? |
This is implemented for the columns now. The patterns discussion should continue in #16283 |
Previously: #15499
Blocked by: #15662
As of #15499, it is possible to resize a Column block using the "Percentage width" input in the block inspector. Since some layouts may be common, we should consider to present the user a choice amongst a few predefined layouts when first inserting a Columns block.
Prior art:
When inserting a new Row block from the Coblocks plugin, the user is presented to choose both the number and from a number of layout options:
Implementation specifics:
The idea for predefined arrangements of inner blocks may be worth abstracting as a general feature for any block which supports nesting.
Specific proposals for layouts:
The text was updated successfully, but these errors were encountered: