Skip to content

Typography: Add column-width support to text columns block support#76781

Open
sidhant-tomar-003 wants to merge 4 commits into
WordPress:trunkfrom
sidhant-tomar-003:feat/typography-column-width
Open

Typography: Add column-width support to text columns block support#76781
sidhant-tomar-003 wants to merge 4 commits into
WordPress:trunkfrom
sidhant-tomar-003:feat/typography-column-width

Conversation

@sidhant-tomar-003

@sidhant-tomar-003 sidhant-tomar-003 commented Mar 24, 2026

Copy link
Copy Markdown

What?

Related: #27118
Follow up to: #74656, #33587

Adds CSS column-width support to the existing textColumns block support, enabling responsive multi-column text layouts.

Why?

The existing textColumns support only outputs column-count, which forces a fixed number of columns at all viewport widths. On narrow screens, columns become unreadably narrow or cause overflow. The CSS column-width property works together with column-count as a responsive pair -- column-count sets the maximum number of columns, and column-width sets the minimum width before the browser drops a column. This is the behavior described in #27118.

How?

  • Adds a new textColumnMinWidth style property to the JS and PHP style engines, mapping to the CSS column-width property.
  • Registers the property in the theme.json CSS property mapping (lib/class-wp-theme-json-gutenberg.php).
  • Adds the property to the block supports typography pipeline (lib/block-supports/typography.php).
  • Creates a new TextColumnsControl component (packages/block-editor/src/components/text-columns-control/) that bundles column count and minimum width into a single ToolsPanelItem.
  • When the user sets columns > 1, a default minimum width of 16em is automatically applied. The user can adjust via S/M/L presets or switch to a custom value input with unit selection (em, rem, px).
  • Resetting the Columns control clears both column-count and column-width.

Testing Instructions

  1. Create or open a post.
  2. Add a Paragraph block with a large amount of text (several sentences).
  3. In the Typography panel, enable the Columns control via the panel options menu if not already visible.
  4. Set columns to 3.
  5. Confirm that the Min Width sub-control appears below with M selected by default.
  6. Try each preset (S, M, L) and confirm the column layout adjusts in the editor.
  7. Click the custom input button (sliders) next to "Min Width" to switch to custom input. Enter a value like 12em and confirm it applies.
  8. Click the custom input button again to switch back to presets. Confirm it snaps to M and the toggle group displays correctly.
  9. Save the post and view the frontend. Resize the browser window or use Responsive Design mode in your browser and confirm columns reduce responsively on narrow viewports.
  10. Reset the Columns control (via the panel options menu) and confirm both column-count and column-width are removed from the block's inline styles.

Testing Instructions for Keyboard

  1. Tab to the Columns number input in the Typography panel and set a value > 1.
  2. Tab to the Min Width toggle group. Use arrow keys to select between S, M, L.
  3. Tab to the settings icon button and press Enter/Space to toggle custom input.
  4. Tab to the UnitControl input, type a value, and Tab to the unit selector to change units.
  5. Press Enter/Space on the custom input button again to return to presets.
  6. Confirm all interactions are reachable and operable via keyboard alone.

Screenshots or screencast

Before After
image image
Columns forced at all widths, broken on mobile Columns adapt responsively based on min width

Changelog

  • Typography: Add column-width (textColumnMinWidth) support to text columns block support.

Use of AI Tools

Claude was used as a coding assistant throughout this PR for guidance on Gutenberg architecture, component patterns, debugging, and drafting code. All code was reviewed, tested, and manually integrated.

@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sidhant-tomar-003 <sidhanttomar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added [Package] Block editor /packages/block-editor [Package] Style Engine /packages/style-engine First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Mar 24, 2026
@github-actions

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @sidhant-tomar-003! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@sidhant-tomar-003

Copy link
Copy Markdown
Author

Warning: Type of PR label mismatch
To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Required label: Any label starting with [Type].
Labels found: .
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

Could a maintainer please add the [Type] Enhancement label? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block editor /packages/block-editor [Package] Style Engine /packages/style-engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant