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
* Title for the menu component. In a managed flyout context, the title is used to indicate the flyout session for history navigation.
89
87
*/
90
88
title?: React.ReactNode;
91
89
/**
92
-
* Hides the title in the flyout menu bar.
93
-
* If the flyout is used in a managed flyout session as a "main" flyout, the default will be true, as main flyouts typically show a title in an EuiFlyoutHeader instead.
94
-
* @default true for main flyout in managed flyout session; false otherwise
90
+
* Hides the title in the `EuiFlyoutMenu`. This is useful when the title is already shown in an `EuiFlyoutHeader`.
91
+
* @default true for main flyout in a managed flyout session; false otherwise
95
92
*/
96
93
hideTitle?: boolean;
97
94
/**
98
-
* Hides the close button in the menu header
95
+
* Hides the close button in the menu component
99
96
* @default false
100
97
*/
101
98
hideCloseButton?: boolean;
102
99
/**
103
-
* Shows a back button in the menu header
100
+
* Shows a back button in the menu component
104
101
* @default false
105
102
*/
106
103
showBackButton?: boolean;
@@ -113,7 +110,7 @@ export type EuiFlyoutMenuProps = CommonProps &
113
110
*/
114
111
historyItems?: EuiFlyoutHistoryItem[];
115
112
/**
116
-
* List of custom action items for the menu header
113
+
* List of custom action items for the menu component
Copy file name to clipboardExpand all lines: packages/website/docs/components/containers/flyout/session-management.mdx
+49-14Lines changed: 49 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,12 +39,17 @@ export default () => {
39
39
<EuiFlyout
40
40
session="start"
41
41
size="s"
42
-
aria-label="Flyout A - main"
43
-
flyoutMenuProps={{
44
-
title: 'Welcome to the flyout session management journey!',
45
-
}}
42
+
aria-labelledby="welcomeHeading"
43
+
flyoutMenuProps={{ title: 'Flyout A' }}
46
44
onClose={() =>setIsOpenFlyoutA(false)}
47
45
>
46
+
<EuiFlyoutHeader>
47
+
<EuiTitle>
48
+
<h2id="welcomeHeading">
49
+
Welcome to the flyout session management journey!
50
+
</h2>
51
+
</EuiTitle>
52
+
</EuiFlyoutHeader>
48
53
<EuiFlyoutBody>
49
54
<EuiText>This flyout is rendered with the <EuiCode>{'session="start"'}</EuiCode> prop set which creates a new flyout session and marks this flyout as main.</EuiText>
50
55
<EuiSpacer />
@@ -60,12 +65,17 @@ export default () => {
60
65
<EuiFlyout
61
66
session="start"
62
67
size="m"
63
-
aria-label="Flyout B - main"
64
-
flyoutMenuProps={{
65
-
title: <>Glad to meet you, {name||'stranger'}!</>,
66
-
}}
68
+
aria-labelledby="flyoutBHeading"
69
+
flyoutMenuProps={{ title: 'Flyout B' }}
67
70
onClose={() =>setIsOpenFlyoutB(false)}
68
71
>
72
+
<EuiFlyoutHeader>
73
+
<EuiTitle>
74
+
<h2id="flyoutBHeading">
75
+
Glad to meet you, {name||'stranger'}!
76
+
</h2>
77
+
</EuiTitle>
78
+
</EuiFlyoutHeader>
69
79
<EuiFlyoutBody>
70
80
<EuiText>
71
81
This flyout is also rendered with the <EuiCode>{'session="start"'}</EuiCode> prop added which creates a <strong>second flyout session</strong> and marks this flyout as main in that session.
@@ -78,7 +88,11 @@ export default () => {
78
88
</EuiButton>
79
89
</EuiFlyoutBody>
80
90
{isOpenFlyoutBChild&& (
81
-
<EuiFlyoutsize="s"aria-label="Flyout B - child"onClose={() =>setIsOpenFlyoutBChild(false)}>
91
+
<EuiFlyout
92
+
size="s"
93
+
aria-label="Child of Flyout B"
94
+
onClose={() =>setIsOpenFlyoutBChild(false)}
95
+
>
82
96
<EuiFlyoutBody>
83
97
<EuiText>
84
98
This is a <strong>child flyout</strong> of Flyout B. It belongs to the same session as Flyout B because it's rendered inside of it and doesn't have the <EuiCode>session</EuiCode> prop set.
@@ -119,9 +133,19 @@ All bindings and configuration will be handled automatically.
119
133
120
134
### Session title
121
135
122
-
Flyout sessions within the managed system require a title that can be
123
-
referenced in the history navigation features. Use the `title`
124
-
field of the `flyoutMenuProps` to set the title of the flyout.
136
+
Managed flyout sessions require a title that can be referenced in the history
137
+
navigation features. Use the `title` field of the `flyoutMenuProps` to set the
138
+
title of the flyout session. If `flyoutMenuProps` is omitted or a `title` field
139
+
is not given in `flyoutMenuProps`, the manager will use the `aria-label`
140
+
attribute of `EuiFlyout` as the source for the session's title. If no source
141
+
for a title is given, a default title will be provided.
142
+
143
+
:::info Note
144
+
The "main" flyout in a session should use `EuiFlyoutHeader` for the actual
145
+
flyout heading. For this reason, the `title` given from `flyoutMenuProps` will
146
+
not be visible to end users. However, a title is still needed for the history
147
+
navigation feature of the flyout session management system.
148
+
:::
125
149
126
150
```tsx
127
151
{/* Render a new main flyout and create a flyout session */}
@@ -130,17 +154,28 @@ field of the `flyoutMenuProps` to set the title of the flyout.
130
154
flyoutMenuProps={{
131
155
title: 'My main flyout'
132
156
}}
157
+
aria-labelledby="myFlyoutHeading"
133
158
>
159
+
<EuiFlyoutHeader>
160
+
<EuiTitle>
161
+
<h2id="myFlyoutHeading">
162
+
I'm the main flyout heading
163
+
</h2>
164
+
</EuiTitle>
165
+
</EuiFlyoutHeader>
134
166
<EuiFlyoutBody>
135
-
I'm the main flyout
167
+
I'm the main flyout body
136
168
</EuiFlyoutBody>
137
169
{/* Render a new child flyout - notice the lack of the `session` prop */}
138
170
<EuiFlyout
139
171
flyoutMenuProps={{
140
172
title: 'My child flyout'
141
173
}}
142
174
>
143
-
I'm the child flyout that belongs to the same session as the main flyout
175
+
{/* Render a child flyout contents. Notice the lack of the EuiFlyoutHeader component - the child flyout menu shows the title from flyoutMenuProps */}
176
+
<EuiFlyoutBody>
177
+
I'm the child flyout that belongs to the same session as the main flyout
0 commit comments