2.1.1 • Published 4 months ago

@lemonadejs/topmenu v2.1.1

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

LemonadeJS Top Menu

Official website and documentation is here

Compatible with Vanilla JavaScript, LemonadeJS, React, Vue or Angular.

The LemonadeJS Top Menu is a functional component designed to facilitate convenient access to key actions within your application. Comprising a set of thoughtfully arranged buttons, this interface ensures a straightforward and efficient user experience.

With a focus on usability, the Top Menu presents a collection of essential features in a visually organized manner. The design emphasizes clarity and simplicity, allowing users to navigate through the menu with ease.

This component serves as a centralized point for accessing core functionalities, contributing to an improved overall user experience. Its adaptable nature enables seamless integration into diverse applications, ensuring a consistent and responsive menu system aligned with your application's requirements.

Getting Started

You can install using NPM or using directly from a CDN.

npm Installation

To install it in your project using npm, run the following command:

$ npm install @lemonadejs/topmenu

CDN

To use Top Menu via a CDN, include the following script tags in your HTML file:

<script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@lemonadejs/topmenu/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@lemonadejs/topmenu/dist/style.min.css" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@lemonadejs/modal/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@lemonadejs/modal/dist/style.min.css" />
<script src="https://cdn.jsdelivr.net/npm/@lemonadejs/contextmenu/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@lemonadejs/contextmenu/dist/style.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />

Usage

Quick example with Lemonade

// Add the following link to your HTML file:
// <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
import Topmenu from '@lemonadejs/topmenu';
import '@lemonadejs/topmenu/dist/style.css';
import '@lemonadejs/contextmenu/dist/style.css';
import '@lemonadejs/modal/dist/style.css';

export default function App() {
    const self = this;

    self.options = [
    {
        title: 'File',
        submenu: [
            {
                title: 'New',
            },
            {
                title: 'Open',
            },
            {
                title: 'Save',
            },
            {
                title: 'Save As',
            },
        ]
    },
    {
        title: 'About Us',
        submenu: [
            {
                title: 'Undo',
            },
            {
                title: 'Redo',
            },
            {
                title: 'Cut',
            },
            {
                title: 'Copy',
            },
            {
                title: 'Paste',
            },
        ]
    },
    {
        title: 'View',
        submenu: [
            {
                title: 'Zoom In',
            },
            {
                title: 'Zoom Out',
            },
        ]
    },
];

    return `<div>
        <Topmenu :options="self.options" :ref="self.topmenu" />
    </div>`
}

Properties

PropertyTypeDescription
optionsoptionItem[]An array of option objects describing the rendering options. Each item should follow the structure defined in the 'Option Properties' section below.

Options Properties

PropertyTypeDescription
title?stringThe title text associated with the option.
submenu?submenuItem[]An optional array containing options displayed as a sub-menu. Each item should follow the structure defined in the 'Submenu Properties' section below.

Submenu Properties

PropertyTypeDescription
title?stringThe title text associated with the option.
submenu?array of submenu optionsAn optional array containing options displayed as a submenu.
onclick?functionOnclick event for the contextmenu item.
render?functionThe function executed when rendering the option.
type?stringContext menu item type: line, divisor, default.
id?stringHTML id property of the item DOM element.
disabled?booleanItem is disabled.
shortcut?stringA short description or instruction for the item. Normally a shortcut. Ex. CTRL + C.
tooltip?stringShow this text when the user mouse over the element.

Keyboard Accessibility and Focus Management

The LemonadeJS Top Menu emphasizes user-friendly keyboard navigation with the following features:

  1. Comprehensive Keyboard Accessibility:

    • Enables seamless navigation through menu options using standard keyboard controls.
  2. Smart Focus Management:

    • Automatically opens submenus upon hovering over options after opening them for the first time.
    • Facilitates exploration of different sections without the need for manual submenu handling.

This design choice not only accommodates users relying on keyboard input but also enhances overall usability, providing an efficient navigation experience.

License

The LemonadeJS Top Menu is released under the MIT.

Other Tools

2.1.1

4 months ago

2.1.0

4 months ago

2.0.2

5 months ago

2.0.0

5 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago