Debian Codegraph @

node/@patternfly/react-core/src/components/Masthead/examples/Masthead.md

raw
1 ---
2 id: Masthead
3 section: components
4 cssPrefix: pf-v6-c-masthead
5 propComponents: ['Masthead', 'MastheadToggle', 'MastheadMain', 'MastheadBrand', MastheadLogo, 'MastheadContent']
6 ---
7
8 import RhUiMenuBarsIcon from '@patternfly/react-icons/dist/js/icons/rh-ui-menu-bars-icon';
9 import pfIcon from '../../assets/PF-HorizontalLogo-Color.svg';
10
11 To maintain proper layout and formatting, a `<Masthead>` should contain both a `<MastheadMain>` and `<MastheadContent>` component.
12
13 Mastheads contain the `<MastheadMain>` that wraps a `<PageToggleButton>` and `<MastheadBrand>`. The `<MastheadBrand>` wraps `<MastheadLogo>`. The masthead also contains the page's header toolbar within `<MastheadContent>`.
14
15 ## Examples
16
17 ### Basic
18
19 ```ts file="./MastheadBasic.tsx"
20 ```
21
22 ### Basic with mixed content
23
24 ```ts file="./MastheadBasicMixedContent.tsx"
25 ```
26
27 ### Display inline
28
29 ```ts file="./MastheadDisplayInline.tsx"
30 ```
31
32 ### Display stack
33
34 ```ts file="./MastheadDisplayStack.tsx"
35 ```
36
37 ### Display stack, display inline responsive
38
39 ```ts file="./MastheadDisplayStackInlineResponsive.tsx"
40 ```
41
42 ### Inset
43
44 ```ts file="./MastheadInsets.tsx"
45 ```
46
47 ### Custom logo component
48
49 In addition to being able to pass a string to the `component` property of `MastheadLogo`, you can provide more fine-tuned customization by passing a callback that returns a component.
50
51
52 ```ts file="./MastheadLogoCustomComponent.tsx"
53 ```
54
55 ## Using router links
56
57 Router links can be used for in-app linking in React environments to prevent page reloading. To use a `Link` component from a router package, you can follow our [custom logo component example](#custom-logo-component) and pass a callback to the `component` property of the `MastheadLogo`:
58
59 ```nolive
60 <MastheadLogo component={(props) => <Link {...props} to="#" />}>
61 <Brand ...brandProps />
62 </MastheadLogo>
63 ```