Skip to content

feat(CalendarMonth): add select prop passthrough#12391

Open
kmcfaul wants to merge 1 commit intopatternfly:mainfrom
kmcfaul:calendarmonth-props
Open

feat(CalendarMonth): add select prop passthrough#12391
kmcfaul wants to merge 1 commit intopatternfly:mainfrom
kmcfaul:calendarmonth-props

Conversation

@kmcfaul
Copy link
Copy Markdown
Contributor

@kmcfaul kmcfaul commented Apr 30, 2026

What: Closes #

Allows a user to pass additional select props and override internal props like popperProps if their user case requires a different configuration.

Summary by CodeRabbit

  • New Features
    • CalendarMonth component now accepts an optional monthSelectProps prop to enable customization of the month dropdown behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Walkthrough

The CalendarMonth component now accepts an optional monthSelectProps prop of type SelectProps, which is spread onto the month dropdown <Select> element to enable external customization of the select component's properties and behavior.

Changes

Cohort / File(s) Summary
CalendarMonth Component
packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx
Added optional monthSelectProps?: SelectProps prop to CalendarProps type and spread it onto the month <Select> element for external prop customization. Updated SelectProps import.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 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 and concisely summarizes the main change: adding support for passing through select props in CalendarMonth component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 30, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx`:
- Around line 84-85: The prop type for monthSelectProps is too strict (it uses
SelectProps which requires toggle); change the declaration of monthSelectProps
to use Partial<SelectProps> so callers can pass only subsets like popperProps.
Update the type on the CalendarMonth component/interface (the monthSelectProps
property) and adjust any usage sites that assume required fields (e.g., avoid
directly calling monthSelectProps.toggle without existence checks) to handle
possibly-undefined members after making it Partial.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a5e62b52-f57d-4114-8cf4-5182be9d70f3

📥 Commits

Reviewing files that changed from the base of the PR and between e47cb62 and 2caf68f.

📒 Files selected for processing (1)
  • packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx

Comment on lines +84 to +85
/** Additional props passed to the month select component. */
monthSelectProps?: SelectProps;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify SelectProps requires toggle
rg -n --type=ts 'export interface SelectProps|toggle:\s*SelectToggleProps' packages/react-core/src/components/Select/Select.tsx

# Verify CalendarMonth typing for monthSelectProps
rg -n --type=ts 'monthSelectProps\?:\s*SelectProps|monthSelectProps\?:\s*Partial<SelectProps>' packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx

Repository: patternfly/patternfly-react

Length of output: 260


monthSelectProps requires the full SelectProps interface, blocking partial passthrough use-cases

Line 85 types monthSelectProps as SelectProps, which has a required toggle property. This prevents callers from passing only specific options like popperProps, making the API ergonomically awkward for typical passthrough scenarios.

Change to Partial<SelectProps> to allow flexible prop passthrough:

Suggested fix
-  monthSelectProps?: SelectProps;
+  monthSelectProps?: Partial<SelectProps>;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/** Additional props passed to the month select component. */
monthSelectProps?: SelectProps;
/** Additional props passed to the month select component. */
monthSelectProps?: Partial<SelectProps>;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/CalendarMonth/CalendarMonth.tsx` around
lines 84 - 85, The prop type for monthSelectProps is too strict (it uses
SelectProps which requires toggle); change the declaration of monthSelectProps
to use Partial<SelectProps> so callers can pass only subsets like popperProps.
Update the type on the CalendarMonth component/interface (the monthSelectProps
property) and adjust any usage sites that assume required fields (e.g., avoid
directly calling monthSelectProps.toggle without existence checks) to handle
possibly-undefined members after making it Partial.

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.

2 participants