@wordpress/ui: add Card and CollapsibleCard components#76252
Conversation
|
Size Change: 0 B Total Size: 6.88 MB ℹ️ View Unchanged
|
|
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. |
| <p | ||
| style={ { | ||
| margin: 0, | ||
| fontFamily: [ 'var(--wp', 'ds-font-family-body)' ].join( '' ), |
There was a problem hiding this comment.
This is a workaround to prevent Storybook breakage, due to how strings in the DS token fallback value (injected at build time) are not correctly escaped.
Fix here: #76254
|
Flaky tests detected in 0778f7b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22775256572
|
aduth
left a comment
There was a problem hiding this comment.
Handful of minor comments and observations, but no blockers. Looks great 👍
| @@ -0,0 +1,28 @@ | |||
| import { Collapsible } from '@base-ui/react/collapsible'; | |||
There was a problem hiding this comment.
For future: This might be nice to expose as its own standalone component.
There was a problem hiding this comment.
Added as a follow-up in the PR description
| * Whether the collapsible panel is initially open (uncontrolled). | ||
| * @default false | ||
| */ | ||
| defaultOpen?: boolean; |
There was a problem hiding this comment.
Observation: Separately, we should probably document these conventions in components with x + defaultX + onXChange (recognizing that it likely follows from DOM/React defaultValue/defaultChecked naming). Seems similar to other patterns we have with value + onChange + onValueChange.
|
I wonder if |
IMO, I think it should be left to the consumer, since we can't assume that |
What?
Add
CardandCollapsibleCardcomponents to@wordpress/uiWhy?
We're building a new set of UI primitives, see #71196
How?
Create components from scratch using DS tokens, use Base UI's
Collapsiblefor expand/collapse featureTesting Instructions
Check code, unit tests, smoke test in Storybook
Screenshots or screencast
Click to expand
CollapsibleCardvs regularCardCollapsibleCardin closed state, different header content heights:CollapsibleCardin opened state, different header content heights:FullBleed content:
Next Steps
Textand DS tokens once finalizedCollapsibleseparatelydefaultValue/value/onValueChange) and show difference vs nativeonChangecallback for form controls