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

Limit number of columns #10791

Open
mizukimadness opened this issue Oct 19, 2018 · 14 comments
Open

Limit number of columns #10791

mizukimadness opened this issue Oct 19, 2018 · 14 comments
Labels
[Block] Columns Affects the Columns Block [Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.

Comments

@mizukimadness
Copy link

When using the Columns block, is there a way to limit the number of columns?
As of now, the user can choose between 2-6 columns.
If I want to limit this to say, no more than 4 columns, how do I achieve that?

@Soean Soean added the [Type] Question Questions about the design or development of the editor. label Oct 19, 2018
@mtias mtias added the [Feature] Extensibility The ability to extend blocks or the editing experience label Oct 23, 2018
@aduth
Copy link
Member

aduth commented Oct 23, 2018

To my knowledge, this would not be possible except through very complex direct replacement of the Columns edit implementation using the BlockEdit filter, which is not something I'd advise.

Ideally for themer extension, this would be something where the Columns block attributes could be extended / filtered to specify a minimum / maximum value for the columns attribute, which would then be referenced as the min / max attributes passed to the range rendered in the editor.

@aduth aduth added [Type] Enhancement A suggestion for improvement. and removed [Type] Question Questions about the design or development of the editor. labels Oct 23, 2018
@florianbrinkmann
Copy link

Would be great to have the same filter functionality for the gallery block.

@hacknug
Copy link

hacknug commented Dec 11, 2018

+1 for the ability to limit the number of columns also on the Gallery Block.

@swissspidy swissspidy added [Block] Gallery Affects the Gallery Block - used to display groups of images [Block] Columns Affects the Columns Block labels Dec 13, 2018
@swissspidy
Copy link
Member

Created an initial PR for this now, see #12861. Any feedback welcome!

@realworldev
Copy link

As of now, the user can choose between 2-6 columns.

Or enter as many as the user wants...
99-columns
WP 5.0.2-alpha-44105 at wordpress.org/gutenberg

@hacknug
Copy link

hacknug commented Dec 14, 2018

I was thinking about this and I'm not sure it is a good idea to limit the minimum amount of columns to 2. Having 1 there would allow this block to work as a container which I'm pretty sure in some cases would be useful to add some custom classes to the block or something similar.

@swissspidy
Copy link
Member

Having 1 there would allow this block to work as a container which I'm pretty sure in some cases would be useful to add some custom classes to the block or something similar.

This is better done in a separate section block, see #4900.

Or enter as many as the user wants...

That sounds like a bug in the RangeControl component to me. I just crashed my browser by typing a super high number in there because adding columns is so slow. The maximum enforces a limit when clicking the upper arrow, but it's not validated onChange.

@realworldev
Copy link

This is better done in a separate section block, see #4900.

Too late, issue open since 10 months, still no such block in Gutenberg, so people look for, find and use "one column" blocks as an alternative, one example of many out there...

@hacknug
Copy link

hacknug commented Dec 18, 2018

Having 1 as the minimum would make it work similar to the gallery block.

Also makes sense for the following scenario:

  • Designer designs responsive website
  • Developer defines some front-end breakpoints according to the design spec
  • Developer sets minimum and maximum values of columns for columns and gallery block (maybe there's other blocks where this would make sense)
  • Editor sets a different amount of columns for each of those breakpoints (1 for mobile 99% of the time)

Some plugins are already adding controls to customize a block's options given multiple breakpoints. This would be useful to have in core for theme developers and I guess it'll land at some point in the future?

@andrewstaffell
Copy link

This could be achieved very neatly by the method we're proposing in #18892

@andrewstaffell
Copy link

As well as restricting column choices it would also be useful to be able to disable manual resizing (of column widths) for certain layouts; again the method proposed #18892 would seem like a clean and simple way to permit this; the block would just need to be made sensitive to the presence of the relevant extensions.

@NicoHood
Copy link

NicoHood commented May 6, 2022

Is there a way to add more than 6 columns? I'd like to have 8, but that is not supported right now.

@webfolkcreative
Copy link

Is there a way to add more than 6 columns? I'd like to have 8, but that is not supported right now.

I am in the same boat. I understand the desire to limit, but I would prefer to have the control I need.

@bph bph moved this from Needs discussion to Triage in Increase Gutenberg Extensibility Nov 23, 2023
@bph bph moved this from Triage to Todo in Increase Gutenberg Extensibility Jan 23, 2024
@t-hamano
Copy link
Contributor

Is there a way to add more than 6 columns?

You could add more columns by doing "Add before" or "Add after", or you could duplicate the Column block via keyboard shortcuts.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Columns Affects the Columns Block [Block] Gallery Affects the Gallery Block - used to display groups of images [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement.
Projects
Development

Successfully merging a pull request may close this issue.