Skip to content

Commit 3934a1f

Browse files
committed
[Flyout System] Improve docs of EuiFlyoutMenu
1 parent f00a6a4 commit 3934a1f

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

packages/eui/src/components/flyout/flyout_menu.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ const HistoryPopover: React.FC<{
162162
);
163163
};
164164

165+
/**
166+
* The component for the top menu bar inside a flyout. Since this is a private
167+
* component, rendering is controlled using the `flyoutMenuProps` prop on
168+
* `EuiFlyout`. In managed session flyouts, the Flyout Manager controls a back
169+
* button and history popover for navigating to different flyout sessions
170+
* within the managed context.
171+
*
172+
* @private
173+
*/
165174
export const EuiFlyoutMenu: FunctionComponent<EuiFlyoutMenuProps> = ({
166175
titleId,
167176
className,

packages/website/docs/components/containers/flyout/index.mdx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,17 +1023,31 @@ import { EuiBetaBadge } from '@elastic/eui';
10231023
This component is still in beta and may change in the future.
10241024
:::
10251025

1026+
`EuiFlyoutMenu` is the top menu bar of a flyout. It is a private component, and is controlled by the `flyoutMenuProps` prop of `EuiFlyout`.
1027+
10261028
```tsx
1027-
<EuiFlyout>
1028-
<EuiFlyoutMenu>
1029-
Hi mom
1030-
</EuiFlyoutMenu>
1031-
<EuiFlyoutHeader>Parent header</EuiFlyoutHeader>
1032-
<EuiFlyoutBody>Parent body</EuiFlyoutBody>
1033-
<EuiFlyoutFooter>Parent footer</EuiFlyoutFooter>
1029+
<EuiFlyout
1030+
onClose={() => {}}
1031+
flyoutMenuProps={{
1032+
title: 'My flyout',
1033+
customActions: [
1034+
{
1035+
iconType: 'gear',
1036+
['aria-label']: 'Settings',
1037+
onClick: () => {
1038+
console.log('Settings clicked');
1039+
},
1040+
},
1041+
],
1042+
}}
1043+
>
1044+
<EuiFlyoutBody>Flyout body</EuiFlyoutBody>
1045+
<EuiFlyoutFooter>Flyout footer</EuiFlyoutFooter>
10341046
</EuiFlyout>
10351047
```
10361048

1049+
In [managed session flyouts]('./session-management.mdx'), the Flyout Manager controls a back button and a history popover control for navigating to different flyout sessions within the managed context.
1050+
10371051
## Props
10381052

10391053
import docgen from '@elastic/eui-docgen/dist/components/flyout';

packages/website/docs/components/containers/flyout/session-management.mdx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,29 @@ session as the main flyout - you can set `session="inherit"` or omit the `sessio
117117
as "inherit" is the default behavior.
118118
All bindings and configuration will be handled automatically.
119119

120+
### Session title
121+
122+
Flyout sessions within the managed system require a title that can be
123+
referenced in the history navigation features of the system. Use the `title`
124+
field of the `flyoutMenuProps` to set the title of the flyout.
125+
120126
```tsx
121127
{/* Render a new main flyout and create a flyout session */}
122-
<EuiFlyout session="start">
128+
<EuiFlyout
129+
session="start"
130+
flyoutMenuProps={{
131+
title: 'My main flyout'
132+
}}
133+
>
123134
<EuiFlyoutBody>
124135
I'm the main flyout
125136
</EuiFlyoutBody>
126137
{/* Render a new child flyout - notice the lack of the `session` prop */}
127-
<EuiFlyout>
138+
<EuiFlyout
139+
flyoutMenuProps={{
140+
title: 'My child flyout'
141+
}}
142+
>
128143
I'm the child flyout that belongs to the same session as the main flyout
129144
</EuiFlyout>
130145
</EuiFlyout>
@@ -136,7 +151,12 @@ can set `session="never"` which will render it as a regular unmanaged flyout.
136151
```tsx
137152
<>
138153
{/* Render a new main flyout and create a flyout session */}
139-
<EuiFlyout session="start">
154+
<EuiFlyout
155+
session="start"
156+
flyoutMenuProps={{
157+
title: 'My flyout in a session'
158+
}}
159+
>
140160
<EuiFlyoutBody>
141161
I'm the main flyout in a session
142162
</EuiFlyoutBody>

0 commit comments

Comments
 (0)