Download the PHP package onokumus/metismenujs without Composer
On this page you can find all versions of the php package onokumus/metismenujs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package metismenujs
metismenujs
Collapsible menu plugin with Vanilla-JS
Table of Contents
- Browser Support
- Installing
- Package manager
- CDN
- Usage
- Stopping list opening on certain elements
- Options
- API
- dispose
- update
- Events
- CSS custom properties (variables)
- Migrating to v1.0.3 from v1.4.0
- Examples
- Demo
- About
- Related projects
- Contributing
- Author
- License
Browser Support
This plugin does not support any version of IE browser.
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | ❌ |
Install
Package Managers
Using npm:
Using yarn:
Using pnpm:
Once the package is installed, you can import the library using import
or require
approach:
If you use require
for importing, only default export is available:
Note CommonJS usage In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with
require()
, add the following to yourtsconfig.json
:
CDN
ES6 UMD browser module
Using jsDelivr CDN:
Using unpkg CDN:
ES6 ES module
Using jsDelivr CDN:
Using unpkg CDN:
Install with composer
Download
Ready to use files are located in the dist
directory.
Usage
-
Include metismenujs StyleSheet
Using CDN
jsDelivr :
unpkg :
Using Vite, Astro etc.
or sass source file
-
Add class
metismenu
to unordered list -
Make expand/collapse controls accessible
Be sure to add
aria-expanded
to the elementa
. This attribute explicitly defines the current state of the collapsible element to screen readers and similar assistive technologies. If the collapsible element is closed by default, it should have a value ofaria-expanded="false"
. If you've set the collapsible element's parentli
element to be open by default using theactive
class, setaria-expanded="true"
on the control instead. The plugin will automatically toggle this attribute based on whether or not the collapsible element has been opened or closed. -
Arrow Options
add
has-arrow
class toa
element - Call the plugin:
Stopping list opening on certain elements
Setting aria-disabled="true" in the <a>
element as shown will stop metisMenu opening the menu for that particular list. This can be changed dynamically and will be obeyed correctly:
Options
Option | Type | Default | Description | Example |
---|---|---|---|---|
toggle | Boolean | true | For auto collapse support. | new MetisMenu("#menu", { toggle: false }); |
triggerElement | css selector | a | new MetisMenu("#menu", { triggerElement: '.nav-link' }); |
|
parentTrigger | css selector | li | new MetisMenu("#menu", { parentTrigger: '.nav-item' }); |
|
subMenu | css selector | ul | new MetisMenu("#menu", { subMenu: '.nav.flex-column' }); |
API
dispose
For stop and destroy metisMenu.
update
Re-init metisMenu.
Events
Event Type | Description |
---|---|
show.metisMenu | This event fires immediately when the show instance method is called. |
shown.metisMenu | This event is fired when a collapse ul element has been made visible to the user (will wait for CSS transitions to complete). |
hide.metisMenu | This event is fired immediately when the hide method has been called. |
hidden.metisMenu | This event is fired when a collapse ul element has been hidden from the user (will wait for CSS transitions to complete). |
CSS custom properties (variables)
Property | Default | Description |
---|---|---|
--mm-transition-timing-function | ease | This property sets how intermediate values are calculated for CSS properties being affected by a transition effect. |
--mm-trantisition-duration | 0.35s | This property sets the length of time a transition animation should take to complete. |
Migrating to v1.0.3 from v1.4.0
- Update
metisMenu.js
&metisMenu.css
files - Change
active
class tomm-active
Examples
https://github.com/metismenu/examples
Demo
https://onokumus.github.io/metismenujs
Contains a simple HTML file to demonstrate metisMenu plugin.
About
Related projects
- metismenu: A jQuery menu plugin | homepage
- @metismenu/react: react.js component for metismenu | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Osman Nuri Okumus
License
Copyright © 2023, Osman Nuri Okumuş. Released under the MIT License.