UI Card: full bleed as header hero image & content cover#77856
UI Card: full bleed as header hero image & content cover#77856
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
d0819e2 to
d72f28b
Compare
|
Size Change: +198 B (0%) Total Size: 7.87 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Makes sense to me. Nice change :) |
d72f28b to
df2abb3
Compare
|
Flaky tests detected in df2abb3. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25259791317
|
mirka
left a comment
There was a problem hiding this comment.
As I understand it, Header and Content are both just non-semantic containers with padding. So there's no reason to put your image in those containers if it doesn't suit your desired layout.
Of the new cases listed, on first glance there seem to be existing solutions without even using FullBleed:
- As the first child of
Card.Header→ Place the image outside theHeader, directly insideRoot. - As the sole child of
Card.Content→ OmitContentand just place the image directly insideRoot.
If this is true, should these just be documented as patterns in the Storybook examples, rather than adding new styles? The added styles do add a good amount of complexity and testing surface, so ideally we just improve the documentation if valid solutions already exist.
What?
Adds "full bleed" hero image header and hero image cover by allowing the container to bump against the top or bottom borders.
Why?
Hero images in cards are a common pattern, e.g.:
Full cover images within card containers are also common.
How?
Card:Card.FullBleednow supports edge-bumping in additional positions:Card.Header, it extends flush to the card's top and side edges — ideal for hero images. Any siblings that follow (e.g.Card.Title) retain normal padding above them.Card.Content, it extends flush to the card's side edges and additionally to the top edge whenContentis the first card child, or the bottom edge when it is the last. This enables full-bleed content panels with or without a header above them.overflow: clipandborder-radiushandle rounded-corner clipping in all cases.Usage
Hero image with header title and with content
Just the image as header with content
Just the image as content
Header + just the image as content
Testing Instructions
See storybook examples:
npm run storybook:devTesting Instructions for Keyboard
Screenshots or screencast
Before, without these changes, there was always top-margin and no ability to combine header title with full bleed:
Use of AI Tools