npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-menubar

v1.0.6

Published

Simple basic menubar with step-into view display menu items(not tree view display) for angular14+.

Downloads

21

Readme

Ngx Menubar component

Simple basic menubar with step-into view display menu items(not tree view display).

This component without size change while state changed, as you can define in your custom parent element as more freedom.

Open Menubar demo preview.

Installation

  1. Install: npm i ngx-menubar;

  2. Add to module or standalone component:

    import {CyxMenubarComponent} from "ngx-menubar";
       
    @NgModule({
      // ...
      imports: [
        // ...
        CyxMenubarComponent
      ]
    })

    or

    import {CyxMenubarComponent} from "ngx-menubar";
       
    @Component({
      // ...
      imports: [
        CyxMenubarComponent
      ]
      // ...
    })
    export class AppComponent {
       
    }

Example

app.component.css

.container {
  width: 350px;
  height: 500px;
  transition: width .2s ease-out;
  box-shadow: 1px 2px 8px rgba(0, 0, 0, .45);
}

.container.close {
  width: 50px;
}

app.component.html


<div class="container" [class.close]="!menubar.isExpand">
  <cyx-menubar #menubar [datasource]="items">
    <!-- some elements can be here if property 'enableDocPanel' set to true. -->
  </cyx-menubar>
</div>

app.component.ts

@Component({...})
export class AppComponent {
  items: IMenuItem[] = [
    {id: 1, title: 'runtime', icon: 'deployed_code', children: []},
    {
      id: 2, title: 'main', children: [
        {id: 5, title: 'app-routing.module.ts', children: []},
        {id: 6, title: 'app.module.ts', children: []},
        {id: 7, title: 'app.component.ts', children: []}
      ]
    },
    //...
  ]
}

Directives

| Name | Default value | Description | |------------------------------------------------------|-------------------------------|--------------------------------------------------------------| | @Input() title: string | 'Menu' | Default Top menu title. | | @Input() datasource: IMenuItem[] | [] | Menu items. | | @Input() color: string | 'dark' | Theme color, 'dark' or 'light'. | | @Input() minimizable: boolean | true | Enable minimizable or not, if false (expand) will not work. | | @Input() enableDocPanel: boolean | false | Show bottom doc panel. | | @Input() iconParser: Function | (icon: string) => icon | Parse icon which from menu item data field IMenuItem#icon. | | @Input() searchConfig: SearchConfig | {...} | Global menu item search configuration. | | @Output() expand: EventEmitter<boolean> | | Menubar display state change event. | | @Output() itemClick: EventEmitter<IMenuItem> | | Menu item click event. |

Properties

| Name | Default value | Description | |-------------------------|---------------|-------------------------------| | selectedItem: IMenuItem | null | Selected item. | | isExpand: boolean | true | Is menubar expanded or not. | | get isTopMenu | true | Is menu top level. | | get docDisplayClass | 'hide' | Doc panel display class name. |

Appendix

IconParser

Example of parse icon name to icon html.

// menu item data.
// {id: 1, title: '...', icon: 'deployed_code'}

// font icon.
icon => `<span class="material-symbols-sharp">${icon}</span>`
// svg icon.
icon => `<svg viewBox="...">...</svg>`

IMenuItem

Menubar menu item type.

export interface IMenuItem {
  id: number | string;
  title: string;
  icon?: string;
  children?: IMenuItem[];
  data?: { [key: string]: any }
}

SearchConfig

export interface SearchConfig {
  placeHolder?: string;
  predicate?: (keyword: string, item: IMenuItem) => boolean;
}

DefaultSearchConfig

{
  placeHolder: 'search',
    predicate
:
  (keyword, item) => item.title.toLowerCase().includes(keyword.toLowerCase())
}