A container with hover-activated menu in configurable positions
Hover over the card to see the menu button appear in the bottom-left corner (default position).
This is a card wrapped in a ContainerBox. Hover over it to see the menu button appear. Click on menu items to see actions.
Demonstrates menu button in all four corner positions.
Menu button appears in the top-left corner when you hover.
Menu button appears in the top-right corner when you hover.
Menu button appears in the bottom-left corner when you hover.
Menu button appears in the bottom-right corner when you hover.
Menu button is always visible, not just on hover.
The menu button is always visible on this container, no hover required.
ContainerBox wrapping an image with various image-related actions. Try clicking on the image itself.
Use the controls below to dynamically change the menu position and visibility.
Use the buttons below to change the menu position and visibility settings dynamically.
Container with nested submenu items, demonstrating the full power of PopoverMenu integration.
This container has a menu with nested submenus for more complex actions.
// Import the ContainerBox component
import { ContainerBoxElement } from '@liwe3/webcomponents';
// Get the container element
const box = document.querySelector('liwe3-container-box');
// Set menu items
box.setMenuItems([
{
label: 'Edit',
onclick: () => console.log('Edit clicked')
},
{
label: 'Delete',
onclick: () => console.log('Delete clicked')
},
{ label: '---sep' },
{
label: 'More',
items: [
{
label: 'Share',
onclick: () => console.log('Share clicked')
},
{
label: 'Duplicate',
onclick: () => console.log('Duplicate clicked')
}
]
}
]);
// Set menu position
box.setMenuPosition('top-right');
// Make menu always visible
box.setAlwaysShowMenu(true);
/* Available CSS variables for customization */
liwe3-container-box {
--container-box-menu-bg: #fff;
--container-box-menu-border: #ddd;
--container-box-menu-radius: 4px;
--container-box-menu-padding: 6px 10px;
--container-box-menu-shadow: 0 2px 8px rgba(0,0,0,0.15);
--container-box-menu-color: #333;
--container-box-menu-hover-bg: #f5f5f5;
--container-box-menu-offset: 8px;
}