Menu

Menu UI Component

Installation

npm i @synerise/ds-menu
or
yarn add @synerise/ds-menu

Usage

import Menu from '@synerise/ds-menu'
const items = [
{
text: 'Item 1',
copyable: true,
copyHint: 'Copy to clipboard',
copyValue: 'Item 1',
copyTooltip: 'Copied Item 1!'
},
{
text: 'Item 2',
copyable: true,
copyHint: 'Copy to clipboard',
copyValue: 'Item 2',
copyTooltip: 'Copied Item 2!'
},
];
// Render using dataSource passed as prop
<Menu dataSource={items} />
// Render using dataSource mapping to Menu.Item
<Menu>
{items.map(item => <Menu.Item {...item}/>}
</Menu>

Demo

Menu

PropertyDescriptionTypeDefault
asDropdownwMenuAdd additional styles for dropdown menubooleanfalse
dataSourceArray of items to display in menuMenuItemProps[]-
orderedDetermines if items should be displayed with index prefix (starting from 01)booleanfalse

MenuItemProps

PropertyDescriptionTypeDefault
childrenChildren of the itemReact.ReactNode
copyableBoolean to enable option of copying the value to the clipboardbooleanfalse
copyHintText displayed on hovering copyable itemstring
copyValueValue to be copied to clipboard when copyable item is clickedstring
copyTooltipTooltip to be displayed when copyable item is clickedstring / React.ReactNode
disabledDisable an item elementbooleanfalse
descriptionAdditional description displayed inside the itemstring / React.ReactNode
highlightText to be highlighted inside the itemstring
indentLevelIndent level of the text inside the item.Number0
parentBoolean to display arrow for parent itembooleanfalse
prefixelPrefix element node or a function to render it.(hovered: boolean) => React.ReactNode / React.ReactNode-
prefixVisibilityTriggerTrigger for displaying the prefix elementdefault / hoverdefault
sizeSize of the item. Affects the maximum and minimum height.default / largedefault
suffixelSuffix element node or a function to render it.(hovered: boolean) => React.ReactNode / React.ReactNode-
suffixVisibilityTriggerTrigger for displaying the suffix elementdefault / hoverdefault
subMenuArray of nested itemsMenuItemProps[]
textText displayed inside the itemstring / React.ReactNode-
typeType of the itemdefault / select / dangerdefault