1.3.12 • Published 10 months ago
@asup/context-menu v1.3.12
@asup/context-menu
REACT Context menu, because I couldn't quite find what I wanted.
Installation
# with npm
npm install @asup/context-menu
Usage
Context menu provider, takes a list of available actions and renders a context menu on appropriate click. Sub menus can be added within each item. Wrap around the elements that need to have the menu.
import { ContextMenuProvider, IMenuItem } from '@asup/context-menu';
<ContextMenuHandler
menuItems={[
{
label: 'Item 1',
action: () => {
console.log('Item 1 function run');
},
},
{
label: 'Item 2',
action: () => console.log('Item 2 function run'),
group: [
{ label: 'Subitem 2.1', action: () => console.log('Item 2.1 function run') },
],
},
{
label: 'Item 3',
action: () => console.log('Item 3 function run'),
disabled: true,
},
]}
>
<Chilren
where the context menu is applied...
/>
</ContextMenuHandler>
import { ContextWindowStack, ContextWindow }
// Context window stack needs to cover the application, or portion where context windows cannot clash with each other
<ContextWindowStack>
...rest of app
<ContextWindow
id='window-1'
title={'Window 1'}
visible={visible}
style={ window styling, applied to the window div}
onOpen={ called function on opening}
onClose={ called function on closing (close cross in the window)}
>
{window contents}
</ContextWindow>
<ContextWindow
id='window-2'
title={'Window 2'}
visible={visible}
style={ window styling, applied to the window div}
onOpen={ called function on opening}
onClose={ called function on closing (close cross in the window)}
>
{window contents}
</ContextWindow>
...end of app
</ContextWindowStack>
1.3.12
10 months ago
1.3.10
11 months ago
1.3.11
11 months ago
1.3.9
1 year ago
1.3.8
1 year ago
1.3.7
1 year ago
1.3.6
1 year ago
1.3.5
1 year ago
1.3.4
1 year ago
1.3.3
1 year ago
1.3.2
2 years ago
1.3.1
2 years ago
1.2.3
2 years ago
1.2.0
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.0
2 years ago