Skip to content

feat(Page): added responsive docked nav#12327

Draft
thatblindgeye wants to merge 1 commit intopatternfly:mainfrom
thatblindgeye:iss12195_dockNav
Draft

feat(Page): added responsive docked nav#12327
thatblindgeye wants to merge 1 commit intopatternfly:mainfrom
thatblindgeye:iss12195_dockNav

Conversation

@thatblindgeye
Copy link
Copy Markdown
Contributor

@thatblindgeye thatblindgeye commented Apr 8, 2026

What: Closes #12195

Some notes:

  • Docked nav looks to be broken in RTL in both Core demos and the React demo I updated here
  • The button icon (hamburger icon) looks to be misaligned in the docked nav when the text is expanded; looks to be an issue in Core as well
  • Core has the docked nav documented under the Nav component, but in React it's under Page. do we have plans to tidy this up?

Additional issues:

Summary by CodeRabbit

  • New Features

    • Added dock variant styling support to Button and MenuToggle components with optional text-expanded mode.
    • Added compact mode option to logo component.
    • Introduced dock expansion/collapse functionality for Page layout with collapsible navigation and masthead variants.
  • Documentation

    • Updated Page layout example demonstrating docked navigation with responsive UI patterns.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Walkthrough

This PR implements responsive docked navigation by introducing dock and text-expanded styling variants across core components (Button, MenuToggle, Nav), adding a compact masthead logo option, restructuring the Page component's docked layout to support separate mobile and docked mastheads, and providing a complete example implementation with expandable dock state management.

Changes

Cohort / File(s) Summary
Core Component Props
packages/react-core/src/components/Button/Button.tsx, packages/react-core/src/components/MenuToggle/MenuToggle.tsx
Added isDock and isTextExpanded beta boolean props with corresponding conditional class modifiers (styles.modifiers.dock and styles.modifiers.textExpanded) for dock variant styling.
Nav Component
packages/react-core/src/components/Nav/Nav.tsx
Added isTextExpanded beta boolean prop with conditional styles.modifiers.textExpanded class application for docked variant text expansion.
Masthead Logo
packages/react-core/src/components/Masthead/MastheadLogo.tsx
Added isCompact beta boolean prop to support compact logo variant styling via conditional styles.modifiers.compact class application.
Page Component
packages/react-core/src/components/Page/Page.tsx
Restructured docked variant rendering to render masthead outside dock container; added isDockExpanded, isDockTextExpanded (beta), and dockedMasthead props; applied conditional expanded/textExpanded modifiers to dock container.
Demo Updates
packages/react-core/src/demos/Page.md
Added SearchIcon and ThIcon imports for use in examples.
Docked Nav Example
packages/react-core/src/demos/examples/Page/PageDockedNav.tsx
Replaced user dropdown implementation with dock expansion/collapse state management; introduced mobile-only and docked masthead variants with compact logo switching; implemented conditional toolbar rendering (MenuToggle for expanded, Button for collapsed); updated nav to use isTextExpanded prop with conditional tooltip rendering.

Sequence Diagram

sequenceDiagram
    actor User
    participant PageDockedNav
    participant Page
    participant Nav
    participant Button
    participant MenuToggle

    User->>PageDockedNav: Click dock toggle (hamburger)
    PageDockedNav->>PageDockedNav: Update isDockTextExpanded state
    PageDockedNav->>Page: Pass isDockExpanded, isDockTextExpanded, dockedMasthead props
    Page->>Page: Apply dock expanded/textExpanded modifiers
    PageDockedNav->>Nav: Pass isTextExpanded prop
    Nav->>Nav: Conditionally apply textExpanded class
    Nav->>Nav: Show/hide nav item text based on isTextExpanded
    PageDockedNav->>Button: Render dock variant (conditionally show/hide)
    Button->>Button: Apply dock and textExpanded modifiers
    PageDockedNav->>MenuToggle: Render dock variant (conditionally show/hide)
    MenuToggle->>MenuToggle: Apply dock and textExpanded modifiers
    PageDockedNav->>User: Render updated dock UI with expanded/collapsed state
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • mcoker
  • lboehling
  • nicolethoen
  • kmcfaul
🚥 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 accurately describes the main feature addition—responsive docked navigation in the Page component—which is the primary focus of the changeset.
Linked Issues check ✅ Passed All major requirements from issue #12195 are met: Page, Button, MenuToggle, Nav modifiers added; MastheadLogo compact support implemented; dock expansion/collapse functionality implemented in PageDockedNav example.
Out of Scope Changes check ✅ Passed All changes align with the docked nav implementation requirements; no unrelated modifications detected across Button, MastheadLogo, MenuToggle, Nav, Page, and PageDockedNav components.
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.

@patternfly-build
Copy link
Copy Markdown
Collaborator

patternfly-build commented Apr 8, 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.

🧹 Nitpick comments (2)
packages/react-core/src/demos/examples/Page/PageDockedNav.tsx (1)

427-427: Remove unnecessary fragment wrapper.

The Page component is the only child element, so the wrapping fragment (<>...</>) is unnecessary.

♻️ Proposed fix
   return (
-    <>
-      <Page
+    <Page
       variant="docked"
       isDockExpanded={isDockExpanded}
       ...
-      </Page>
-    </>
+    </Page>
   );

Also applies to: 460-461

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/demos/examples/Page/PageDockedNav.tsx` at line 427,
The fragment wrapper around the single child Page component is unnecessary;
remove the surrounding <>...</> so that Page is returned/rendered directly.
Update both locations where a fragment encloses Page in PageDockedNav.tsx (the
JSX that currently wraps <Page ... />) to eliminate the fragment and leave just
the Page element, ensuring any props or surrounding JSX remain intact.
packages/react-core/src/components/Page/Page.tsx (1)

31-31: Add JSDoc description and @beta tag for dockedMasthead prop.

The dockedMasthead prop is missing both a JSDoc description and the @beta tag, unlike the other new dock-related props (isDockExpanded, isDockTextExpanded).

📝 Proposed fix
-  dockedMasthead?: React.ReactNode;
+  /** `@beta` Docked masthead component rendered inside the dock container. Only applies when variant is docked. */
+  dockedMasthead?: React.ReactNode;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-core/src/components/Page/Page.tsx` at line 31, The prop
declaration dockedMasthead?: React.ReactNode is missing a JSDoc comment and the
`@beta` tag; add a short JSDoc description explaining it renders the masthead when
the dock is anchored (matching style of isDockExpanded/isDockTextExpanded) and
prepend `@beta` so it appears in generated docs, ensuring formatting/comments
follow the existing JSDoc conventions used in Page.tsx.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/react-core/src/components/Page/Page.tsx`:
- Line 31: The prop declaration dockedMasthead?: React.ReactNode is missing a
JSDoc comment and the `@beta` tag; add a short JSDoc description explaining it
renders the masthead when the dock is anchored (matching style of
isDockExpanded/isDockTextExpanded) and prepend `@beta` so it appears in generated
docs, ensuring formatting/comments follow the existing JSDoc conventions used in
Page.tsx.

In `@packages/react-core/src/demos/examples/Page/PageDockedNav.tsx`:
- Line 427: The fragment wrapper around the single child Page component is
unnecessary; remove the surrounding <>...</> so that Page is returned/rendered
directly. Update both locations where a fragment encloses Page in
PageDockedNav.tsx (the JSX that currently wraps <Page ... />) to eliminate the
fragment and leave just the Page element, ensuring any props or surrounding JSX
remain intact.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d29e4335-40ec-48f1-a7ba-77f905c7e5a5

📥 Commits

Reviewing files that changed from the base of the PR and between 911223a and 10b8bcd.

📒 Files selected for processing (7)
  • packages/react-core/src/components/Button/Button.tsx
  • packages/react-core/src/components/Masthead/MastheadLogo.tsx
  • packages/react-core/src/components/MenuToggle/MenuToggle.tsx
  • packages/react-core/src/components/Nav/Nav.tsx
  • packages/react-core/src/components/Page/Page.tsx
  • packages/react-core/src/demos/Page.md
  • packages/react-core/src/demos/examples/Page/PageDockedNav.tsx

@thatblindgeye thatblindgeye marked this pull request as draft April 8, 2026 14:04
isDockTextExpanded?: boolean;
/** Masthead component (e.g. <Masthead />) */
masthead?: React.ReactNode;
dockedMasthead?: React.ReactNode;
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.

Update this name to dockContent, update masthead prop description to mention it's for mobile masthead when variant is docked

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.

Docked nav - implement responsive solution in Page layout

2 participants