Skip to content

ui guidelines: add custom properties and disabled state guidance#75912

Merged
ciampo merged 2 commits into
trunkfrom
docs/ui-custom-props-layers-composition
Feb 26, 2026
Merged

ui guidelines: add custom properties and disabled state guidance#75912
ciampo merged 2 commits into
trunkfrom
docs/ui-custom-props-layers-composition

Conversation

@ciampo
Copy link
Copy Markdown
Contributor

@ciampo ciampo commented Feb 25, 2026

What?

Following up the conversation in #75568 (comment), add a section in the @wordpress/ui guidelines around how to use custom properties in the context of composing and re-defining them across several components.

Why?

Writing documentation helps us enforce good pattenrs and avoid bad patterns.

How?

Added a section to the GUIDELINES docs

Testing Instructions

Read the added sections of the docs

@ciampo ciampo self-assigned this Feb 25, 2026
@ciampo ciampo added [Type] Developer Documentation Documentation for developers [Package] UI /packages/ui labels Feb 25, 2026
@ciampo ciampo marked this pull request as ready for review February 25, 2026 15:28
@ciampo ciampo requested a review from a team as a code owner February 25, 2026 15:29
Copy link
Copy Markdown
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 It's a bit on the longer side and maybe we can tighten it up a bit, though it's a complex topic and I think the explanations under "Rule" and "Why" sections really help illustrate the problem.

Comment thread packages/ui/CONTRIBUTING.md
Comment thread packages/ui/CONTRIBUTING.md Outdated

### Disabled State Styling

When styling disabled states, use the `data-disabled` attribute provided by Base UI rather than targeting `disabled` or `aria-disabled` directly. Base UI applies `data-disabled` consistently regardless of whether the underlying implementation uses the native `disabled` attribute or `aria-disabled` (which depends on the `focusableWhenDisabled` prop). This keeps styles decoupled from the specific HTML attribute and avoids verbose selectors that would need to target both.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it assumed that all components that would be disable-able would be using BaseUI? The guidance here is pretty specific to those use-cases (specifically focusableWhenDisabled), and if we had any components that could be disabled but don't use BaseUI, I might be pretty confused by what I'm expecting to do with disabled styling.

Copy link
Copy Markdown
Contributor Author

@ciampo ciampo Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added that this specifically refers to Base UI-based components. Also happy to remove the section altogether if you think it's too detailed / doesn't bring much value.

@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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

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

@ciampo
Copy link
Copy Markdown
Contributor Author

ciampo commented Feb 26, 2026

@aduth I followed your feedback. Happy to iterate in follow-ups if necessary.

@ciampo ciampo enabled auto-merge (squash) February 26, 2026 12:08
@ciampo ciampo merged commit 7150eef into trunk Feb 26, 2026
38 checks passed
@ciampo ciampo deleted the docs/ui-custom-props-layers-composition branch February 26, 2026 12:46
@github-actions github-actions Bot added this to the Gutenberg 22.7 milestone Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] UI /packages/ui [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants