You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docked navigation pattern provides a responsive vertical navigation layout that adapts between mobile and desktop viewports. On mobile, the navigation appears as an overlay, while on desktop it displays as a persistent vertical sidebar that can toggle between icon-only and text+icon modes.
84
+
85
+
**Key implementation requirements:**
86
+
87
+
1.**Page component**: Set `variant="docked"` to enable the docked layout. Pass `isDockExpanded` and `isDockTextExpanded` state props to control mobile overlay and desktop text visibility.
88
+
89
+
2.**Masthead structure**: Use two separate mastheads:
90
+
-**Mobile masthead**: Set `display={{ default: 'inline' }}` so it only appears on mobile. Include a hamburger toggle button, logo, and any mobile-specific actions.
91
+
-**Docked masthead**: Set `variant="docked"` for the vertical navigation sidebar. This contains the navigation toggle, nav items, and action buttons.
92
+
93
+
3.**Navigation component**: Set `variant="docked"` on Nav and pass `isTextExpanded={isDockTextExpanded}` to control text visibility. NavItems should include both icons and text children—the Nav component will handle showing/hiding text based on state.
94
+
95
+
4.**Buttons and toggles**: Use `isDocked` and `isTextExpanded` props on Button and MenuToggle components within the docked navigation. These props apply dock-specific styling that toggles between icon-only and text+icon display.
96
+
97
+
5.**Logo variants**: Use `isCompact` prop on MastheadLogo to show an icon-only logo when the dock is collapsed, and a full logo with text when expanded.
98
+
99
+
6.**Focus management**: Implement focus shifting between the mobile toggle button and docked nav toggle button when opening/closing the navigation for better keyboard accessibility.
100
+
101
+
7.**Tooltips**: Only render tooltips when text is hidden (icon-only mode) to avoid showing redundant information when text labels are already visible.
102
+
103
+
8.**State management**:
104
+
-`isDockExpanded`: Controls whether the mobile overlay is shown
105
+
-`isDockTextExpanded`: Controls whether text is displayed alongside icons on desktop
Copy file name to clipboardExpand all lines: packages/react-core/src/demos/Page.md
-8Lines changed: 0 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,6 @@ import CloudIcon from '@patternfly/react-icons/dist/esm/icons/cloud-icon';
18
18
import CodeIcon from '@patternfly/react-icons/dist/esm/icons/code-icon';
19
19
import pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';
20
20
import pfIconLogo from '@patternfly/react-core/src/demos/assets/PF-IconLogo-color.svg';
21
-
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
22
-
import ThIcon from '@patternfly/react-icons/dist/esm/icons/th-icon';
23
21
24
22
- All examples set the `isManagedSidebar` prop on the Page component to have the sidebar automatically close for smaller screen widths. You can also manually control this behavior by not adding the `isManagedSidebar` prop and instead:
25
23
1. Add an onNavToggle callback to PageHeader
@@ -54,9 +52,3 @@ When adding a context selector/perspective switcher in a `PageSidebar`, you must
0 commit comments