diff --git a/src-docs/src/views/context_menu/context_menu_example.js b/src-docs/src/views/context_menu/context_menu_example.js index 0694c88222d..63ce541d310 100644 --- a/src-docs/src/views/context_menu/context_menu_example.js +++ b/src-docs/src/views/context_menu/context_menu_example.js @@ -9,6 +9,7 @@ import { EuiContextMenu, EuiContextMenuItem, EuiContextMenuPanel, + EuiTitle, } from '../../../../src/components'; import { EuiContextMenuPanelDescriptor } from '!!prop-loader!../../../../src/components/context_menu/context_menu'; @@ -173,6 +174,9 @@ export const ContextMenuExample = { ], text: ( <> + +

Custom panels

+

Context menu panels can be passed React elements through the{' '} content prop instead of items. @@ -184,16 +188,24 @@ export const ContextMenuExample = { width: [number of pixels] to the panel tree.

+ +

Custom items

+

You can add separator lines in the items prop if you define an item as{' '} {'{isSeparator: true}'}. This will - pass the rest of its fields as props to a{' '} + pass the rest of the object properties to an{' '} EuiHorizontalRule {' '} component.

+

+ For completely custom rendered items, you can use the{' '} + {'{renderItem}'} property to pass a component or + any function that returns a JSX node. +

), demo: , diff --git a/src-docs/src/views/context_menu/context_menu_with_content.js b/src-docs/src/views/context_menu/context_menu_with_content.js index 0cc869e2f69..fed43aca2d7 100644 --- a/src-docs/src/views/context_menu/context_menu_with_content.js +++ b/src-docs/src/views/context_menu/context_menu_with_content.js @@ -5,6 +5,7 @@ import { EuiContextMenu, EuiIcon, EuiPopover, + EuiPopoverFooter, EuiSpacer, EuiText, } from '../../../../src/components'; @@ -64,10 +65,6 @@ export default () => { icon: , onClick: closePopover, }, - { - isSeparator: true, - key: 'sep', - }, { name: 'See more', icon: 'plusInCircle', @@ -78,6 +75,19 @@ export default () => { content: , }, }, + { + isSeparator: true, + key: 'sep', + }, + { + renderItem: () => ( + + + I'm a custom item! + + + ), + }, ], }); }; @@ -116,7 +126,7 @@ export default () => { ); return ( - + <> { > - + ); };