Skip to content

feat(Menu toggle): Added support for a adding styling for a menu toggle in a form#12326

Open
tlabaj wants to merge 2 commits intopatternfly:mainfrom
tlabaj:menu_toggle
Open

feat(Menu toggle): Added support for a adding styling for a menu toggle in a form#12326
tlabaj wants to merge 2 commits intopatternfly:mainfrom
tlabaj:menu_toggle

Conversation

@tlabaj
Copy link
Copy Markdown
Contributor

@tlabaj tlabaj commented Apr 7, 2026

What: Closes #12279, #12325

  • Added beta boolean prop isInForm (default false). When true, the root toggle element gets the pf-m-form modifier.
  • Added test to isInForm
  • made change to no use hard coded pf-m-text
  • Added a test for when variant="plainText that asserts the toggle has pf-m-plain and pf-m-text modifiers.

Summary by CodeRabbit

  • New Features

    • Added a beta prop to MenuToggle to enable form-specific styling when used inside forms.
    • Improved plainText variant styling to use the correct text modifier for more consistent appearance.
  • Documentation

    • Added example and guidance demonstrating MenuToggle usage inside a form.
  • Tests

    • Added tests verifying plainText styling and the form-specific styling behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ed9e79a3-60ce-46ba-be53-8eb2d6e8b112

📥 Commits

Reviewing files that changed from the base of the PR and between 79fe190 and e64706a.

📒 Files selected for processing (2)
  • packages/react-core/src/components/MenuToggle/examples/MenuToggle.md
  • packages/react-core/src/components/MenuToggle/examples/MenuToggleInForm.tsx
✅ Files skipped from review due to trivial changes (2)
  • packages/react-core/src/components/MenuToggle/examples/MenuToggle.md
  • packages/react-core/src/components/MenuToggle/examples/MenuToggleInForm.tsx

Walkthrough

Added an optional @beta boolean prop isInForm to MenuToggle to conditionally apply form styling; switched plainText variant to use styles.modifiers.text class. Added tests and an example demonstrating isInForm.

Changes

Cohort / File(s) Summary
MenuToggle Component
packages/react-core/src/components/MenuToggle/MenuToggle.tsx
Added optional isInForm?: boolean (@beta) with default false; apply styles.modifiers.form when truthy. For variant === 'plainText', use styles.modifiers.text instead of raw 'pf-m-text'.
MenuToggle Tests
packages/react-core/src/components/MenuToggle/__tests__/MenuToggle.test.tsx
Added assertions: plainText variant includes styles.modifiers.plain and styles.modifiers.text; isInForm adds styles.modifiers.form, and isInForm={false} omits it.
Examples & Docs
packages/react-core/src/components/MenuToggle/examples/MenuToggle.md, packages/react-core/src/components/MenuToggle/examples/MenuToggleInForm.tsx
Added documentation section and example component MenuToggleInForm showing MenuToggle with isInForm and an aria label.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding support for styling a menu toggle in a form context via a new prop.
Linked Issues check ✅ Passed The PR implements the required new prop (isInForm) to style MenuToggle components correctly when used inside forms, directly addressing issue #12279.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objectives: adding the isInForm prop, tests, documentation, and a form example with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tlabaj tlabaj marked this pull request as ready for review April 7, 2026 20:24
@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 7, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update menu toggle to use react-styles for pf-m-text instead of hard coding it MenuToggle - Unified theme updates

2 participants