dropdown-menubar
v1.0.1
Published
A Typescript Menubar element that you can add to your projects built using TS
Readme
About The Project
A simple menubar plugin for TS and JS built with TS.
Built With
Getting Started
Simple plug and play, install the package and use it according to the usage guide.
npm i dropdown-menubarPrerequisites
You must have node installed, otherwise wth you doing here? Might as well update npm while you're at it.
- npm
npm install npm@latest -g
Usage
Create your Dropdown Menubar object by
const menubar = dropDownMenu('menuTitle', 5); // title: string, maxWidth in rem: NumberYou can add menu options and modify them by giving them a title, and a onClickHandler for choosing that option
menubar.addOption({ optionTitle: '1: Prints G -> GG', clickHandler: () => { console.log('G'); }, }); menu1.modifyOption(1, { optionTitle: 'Changed to reload page now', clickHandler: () => { location.reload(); }, });You can change your max width using
menu1.setMaxWidth(10);And you can generate the div element which you can insert into your webpage
const menuDiv = menu1.getElement(); // returns a div of the menubar const body = document.querySelector('body'); body?.appendChild(menuDiv);
Roadmap
Nothing planned so far, may come back to improve ui later?
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Acknowledgements
- Npm icon used as logo: Npm icons created by -Artist - Flaticon

