Debian Codegraph @

node/@patternfly/react-core/src/demos/Page.md

raw
1 ---
2 id: Page
3 section: components
4 ---
5
6 import { useState, useRef, useEffect } from 'react';
7 import RhUiNotificationFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-notification-fill-icon';
8 import RhUiSettingsFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-settings-fill-icon';
9 import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
10 import RhUiQuestionMarkCircleFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-question-mark-circle-fill-icon';
11 import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';
12 import RhUiMenuBarsIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-menu-bars-icon';
13 import LightbulbIcon from '@patternfly/react-icons/dist/esm/icons/lightbulb-icon';
14 import RhUiEllipsisVerticalFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ellipsis-vertical-fill-icon';
15 import CubeIcon from '@patternfly/react-icons/dist/esm/icons/cube-icon';
16 import FolderIcon from '@patternfly/react-icons/dist/esm/icons/folder-icon';
17 import CloudIcon from '@patternfly/react-icons/dist/esm/icons/cloud-icon';
18 import pfLogo from '@patternfly/react-core/src/demos/assets/PF-HorizontalLogo-Color.svg';
19 import pfIconLogo from '@patternfly/react-core/src/demos/assets/PF-IconLogo-color.svg';
20
21 - 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:
22 1. Add an onNavToggle callback to PageHeader
23 2. Pass a boolean into the isNavOpen prop to PageSidebar
24
25 ## Layouts
26
27 This demonstrates a variety of navigation patterns in the context of a full page layout. These can be used as a basis for choosing the most appropriate page template for your application.
28
29 ### Sticky section group
30
31 ```ts file='./examples/Page/PageStickySectionGroup.tsx' isFullscreen
32
33 ```
34
35 ### Sticky section group (alternate syntax)
36
37 ```ts file='./examples/Page/PageStickySectionGroupAlternate.tsx' isFullscreen
38
39 ```
40
41 ### Sticky section breadcrumb (with breakpoints)
42
43 ```ts file='./examples/Page/PageStickySectionBreadcrumb.tsx' isFullscreen
44
45 ```
46
47 ### Context selector/perspective switcher in sidebar
48
49 When adding a context selector/perspective switcher in a `PageSidebar`, you must manually control the open state of the `PageSidebar` as well as ensure any interactive menu toggles or buttons cannot receive focus. This demo adds a `tabIndex` of `-1` when the sidebar is not expanded to achieve this.
50
51 ```ts file='./examples/Page/PageContextSelector.tsx' isFullscreen
52
53 ```