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

@bananin/bselect

v1.0.16

Published

Custom select con Bananin

Downloads

111

Readme

Custom select

Bananin's Select

Install

In head tag

<script src="https://unpkg.com/@bananin/bselect@latest/js/b-select.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://unpkg.com/@bananin/bselect@latest/css/b-select.css" />

Setting

Inside Html body:

<!-- html -->
<div class="mb-3" id="app">
    <b-select
        :items="fullItems"
        ref="bSelect"
        :multiple="true"
        :max="20"
        :buscar="true"
        id="bSel"
        name="bSel"
        @input="cambia()"></b-select>
    <p class="mb-0 mt-2" v-html="selects"></p>
</div>

Javascript code:

//Javascript
const app = Vue.createApp({
    components: {
        "b-select": bSelect
    },
    data() {
        return {
            fullItems:[
                {v:"1",t:"Opción 1"},
                {v:"2",t:"Opción 2",st:"Con Subtitulo"},
                {v:"3",t:"Opción 3",st:"Con Imagen",a:"/img/cara.png"},
                {v:"4",t:"Seleccionada",st:"Subtitulo",a:"/img/cara.png",s:true},
                {v:"5",t:"Disabled",st:"Subtitulo",d:true}
            ]
        };
    },
    methods:{
        cambia(){
            this.selects=JSON.stringify(this.$refs.bSelect.values);
        }
    }
}).mount("#app");

#Options:

  • items: the options that the component will have has the attributes:
  • Mandatory:
    • v: option value
    • t: text to display
  • Optional:
    • st: subtitle
    • a: avatar/image
    • s: item selected by default (Boolean)
    • d: item disabled by default (Boolean)
    • f: optional it's used by "filtrame" method (String)
  • ref: reference you will have to call the component from Vue
  • multiple: you can select more than one item, by default it is disabled
  • buscar: little box to search inside the select, by default it is activated (you can also use a numeric variable to indicate the minimum number of items before the little box appears)
  • max: maximum characters displayed from selected items before grouping into X selected items
  • id: id to be assigned to the select
  • name: name that is assigned to the select
  • input: event that fires when the select component changes

#important

If you change the content of the select manually, for example $('#bSel').val(2); you must execute the reverse method app.$refs.bSelect.inverso(); for the component to update correctly, this is because it is not practical to be listening for manual changes that are applied directly to the select to apply changes to the component. It will probably change in the future.

Example in Custom select con Bananin

License

MIT

Sponsor

With your help I can continue paying the server <3