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 🙏

© 2026 – Pkg Stats / Ryan Hefner

c-navbar

v3.1.1

Published

Single file component navbar creado por Circulo Digital

Downloads

67

Readme

c-navbar

Single file component navbar creado por Circulo Digital

Instalación

npm install c-navbar --save

Utilizando c-navbar

Importación

Para utilizar el c-navbar debe importarse en el componente donde será implementado, o registrado en main.js si se utilizarán diversas instancias en el proyecto

Improtación en componente

<script>
  @import cNavbar from 'c-navbar';
  
  export default {
    components: {
      cNavbar
    }
  }
</script>

Registro global

@import Vue from 'vue';
@import App from './App.vue';
@import cNavbar from 'c-navbar';

Vue.config.productionTip = false;
Vue.component('c-navbar', cNavbar);

new Vue({
  render: h => h(App),
}).$mount('#app');  

Implementación

Una vez importada en el componente o registrada globalmente, basta con utilizarla con la etiqueta <c-navbar></c-navbar>

<template>
  <c-navbar :items="items"></c-navbar>
</template>

Agregar items al navbar

Para agregar items al navbar se debe cargar un array de objetos al prop items, representando cada objeto un item del navbar (ejemplos al final de la sección) Cada objeto puede recibir las siguientes propiedades:

name

Nombre a renderizar en el template

  • Tipo: String
  • Requerido

type

Tipo de elemento a renderizar

  • Tipo: String
  • Valores admitidos:
    • 'router-link': Renderiza un componente <router-link></router-link>
    • 'external-link': Renderiza un elemento <a></a>
    • 'button': Renderiza un elemento <button></button>
    • 'submenu': Renderiza un elemento <ul></ul> con items interiores que se comporta como un submenu
    • 'collapse': Renderiza un elemento <ul></ul> con items interiores que se comporta como un menú colapsable
  • Requerido

url

URL interna o externa a la aplicación a la que será redirigido el usuario al hacer click. Esta propiedad sólo surte efecto si type contiene los valores 'router-link' ó 'external-link'

  • Tipo: String
  • Requerido sólamente si type contiene los valores 'router-link' ó 'external-link'

function

Función que será ejecutada al hacer click en el item. Esta propiedad sólo surte efecto si type contiene el valor 'button'

  • Tipo: Object
  • Propiedades:
    • method: La función que será ejecutada. Debe recibir un sólo parámetro, si se requieren dos o más, trabajar con un Array o un Object.
    • parameters: Parámetros que recibirá la función si los requiriese, si es más de uno deberá enviarse un Array o un Object y armar el método en función de este formato
  • Requerido sólamente si type contiene el valor 'button'

items

Array de objetos que representan items de un submenu o un collapse. Esta propiedad sólo surte efecto si type contiene los valores 'submenu' ó 'collapse'. Los objetos del array deben cumplir el formato de los items que recibe el navbar.

  • Tipo: Array
  • Requerido sólamente si type contiene los valores 'submenu' ó 'collapse'

customClassList

Array de strings con las clases customizadas que recibirá el elemento renderizado

  • Tipo: Array
  • Tipo de valor admitido: String

context

Contexto en el que se renderizará el item, siendo mobile cualquier ancho de pantalla menor al valor de collapseAt y desktop cualquier ancho mayor a ese valor (ver prop collapseAt). Si no se agrega esta propiedad, el elemento será renderizado en ambos contextos.

  • Tipo: String
  • Valores admitidos:
    • 'mobile': El item sera renderizado en cualquier ancho de pantalla menor al valor de collapseAt
    • 'desktop': El item sera renderizado en cualquier ancho de pantalla mayor al valor de collapseAt

Ejemplo

El siguiente ejemplo es del uso de un navbar con un item de cada tipo y con las siguiente especificaciones:

  • El item router-link deberá tener una clase customizada
  • El item external-link deberá tener dos clases customizadas
  • Un item button con una función sin parámetro
  • Un item button con una función con un parámetro
  • Un item button con una función con múltiples parámetros
  • El item submenu deberá ser renderizado únicamente en el contexto 'desktop' y contendrá dos items
  • El item collapse deberá ser renderizado únicamente en el contexto 'mobile' y contendrá dos items
<template>
  <c-navbar :items=""><c-navbar>
</template>
<script>
  @import cNavbar from 'c-navbar';
  export default {
    components> {
      cNavbar
    },
    data() {
      return {
        items: [
          {
            name: 'Router link item'
            type: 'router-link',
            url: '/internal/url/path',
            customClassList: ['custom-class-1']
          },
          {
            name: 'External link item'
            type: 'external-link',
            url: 'external/url/path',
            customClassList: ['custom-class-1', 'custom-class-2']
          },
          {
            name: 'Button item'
            type: 'button',
            function: {
              method: () => {
                console.log('Función sin parámetro');
              }
            },
          },
          {
            name: 'Button item 2'
            type: 'button',
            function: {
              method: (param) => {
                console.log(param);
              },
              parameters: 'This is a parameter'
            },
          },
          {
            name: 'Button item 3'
            type: 'button',
            function: {
              method: (params) => {
                console.log(`param 1: ${params.param1}, param 2: ${params.param2}`);
              },
              parameters: {
                param1: 'param 1,
                param2: 'param 2,'
              }
            },
          },
        ]
      }
    }
  }
</script>