Skip to content

Components: document CSS module class composition#79490

Open
ciampo wants to merge 4 commits into
trunkfrom
codex/components-clsx-module-docs
Open

Components: document CSS module class composition#79490
ciampo wants to merge 4 commits into
trunkfrom
codex/components-clsx-module-docs

Conversation

@ciampo

@ciampo ciampo commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What?

Follow up to #79442.

Clarifies the recommended clsx pattern for conditional CSS Module classes in packages/components/CONTRIBUTING.md.

Why?

Computed object keys can produce a literal undefined class when a CSS Module export is missing in tests.

How?

  • Documents the safer condition && styles.className pattern.
  • Updates the example to use that pattern with className as a direct clsx argument.
  • Adds a packages/components changelog entry.

Testing Instructions

  1. Run npm run lint:md:docs -- packages/components/CONTRIBUTING.md.

Testing Instructions for Keyboard

Not applicable; documentation-only change.

Screenshots or screencast

Not applicable.

Use of AI Tools

Created with assistance from ChatGPT/Codex and reviewed before opening this PR.

@github-actions github-actions Bot added the [Package] Components /packages/components label Jun 24, 2026
@ciampo ciampo self-assigned this Jun 24, 2026
@ciampo ciampo added the [Type] Developer Documentation Documentation for developers label Jun 24, 2026
@ciampo ciampo requested review from jsnajdr and mirka June 24, 2026 13:59
Comment on lines +448 to +450
className,
! __nextHasNoOuterMargins &&
styles.deprecatedOuterMargins,
className
styles.deprecatedOuterMargins

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping the non-object form here, since the object form can produce undefined as an object key

@ciampo ciampo marked this pull request as ready for review June 24, 2026 15:23
@ciampo ciampo requested review from a team and ajitbohra as code owners June 24, 2026 15:23
@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>

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

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

Labels

[Package] Components /packages/components [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant