BoxAction.vue component is a reusable Vue.js component designed to toggle a menu box or overlay panel. It integrates with the useBoxStore Pinia store to manage its open and close states programmatically. The component is often used for displaying action menus, filters, or other contextual information.
Features
Open/Close Management
Uses
useBoxStore to control the open/close state.Customizable Position
Supports
left or right positioning of the box using the from prop.Dynamic Content
Allows the inclusion of custom content via slots.
Accessible
Includes ARIA roles and keyboard support (Escape key) for accessibility.
Usage
Basic Example
Props
The unique identifier for the box, used to control its state via
useBoxStore.The label displayed at the top of the box.
Specifies the position of the box. Options:
'left', 'right'.Example Use Cases
Left-Aligned Box
Right-Aligned Box
Opening a Box Programmatically
Notes
- State Management: The
useBoxStorePinia store is required to manage the open/close state of theBoxActioncomponent. Ensure the store is properly imported and configured. - Custom Content: Use the default slot to include dynamic content such as buttons, icons, or custom components.
- Positioning: The
fromprop controls the alignment of the box. Use'left'or'right'to suit your design requirements.