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

Template Part: Add layout support #69216

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

himanshupathak95
Copy link
Contributor

@himanshupathak95 himanshupathak95 commented Feb 17, 2025

What?

Part of: #43248

Add layout support to the Template Part block.

Why?

Currently, the Template Part block lacks layout controls.

How?

Added layout support by enabling it in the block's configuration ( block.json ). Since the Template Part block already uses useInnerBlocksProps, enabling the layout support property is sufficient to implement this feature.

"supports": {
    "layout": true
}

Testing Instructions

  • Create or edit a template in the Site Editor
  • Add a Template Part block
  • Add blocks inside the Template Part (e.g., paragraphs, headings)
  • Select the Template Part block
  • Verify in the sidebar that:
    • Layout controls are now available
    • The justification is working as expected
    • The width modifications are working as expected

Screencast

Screen.Recording.2025-02-17.at.14.23.32.mov

@Mamaduka Mamaduka added [Type] Enhancement A suggestion for improvement. [Block] Template Part Affects the Template Parts Block [Feature] Layout Layout block support, its UI controls, and style output. labels Feb 18, 2025
@himanshupathak95 himanshupathak95 marked this pull request as ready for review February 18, 2025 06:10
Copy link

github-actions bot commented Feb 18, 2025

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: himanshupathak95 <[email protected]>
Co-authored-by: carolinan <[email protected]>

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

@carolinan
Copy link
Contributor

I don't think this change should be merged, because all options on this block has been omitted on purpose.
The intention is that the template part should remain a container block with all stying applied to the blocks that are inside it.

It is a long read, but here is one of the discussions that led to this decision: #30732
#30732 (comment)

There is also work on unifying the template part and patterns:
#57011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Template Part Affects the Template Parts Block [Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants