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

en-select

v1.5.0

Published

Simple select component for ember.js

Downloads

21

Readme

npm version CircleCI Ember Observer Score

en-select

Simple select component written in ember.js without any external dependencies.

Usage

There are two components: en-select and en-multi-select.

en-select creates a select component that allows a single selection. en-multi-select creates a select component that allows multiple selections.

Here's an example:

  {{en-select label="Placeholder"
              options=options
              on-select=(action "some-action")}}

By default, it expects the options you pass to have id and label properties. You can also specify a custom path for them. Here's an example.

  {{en-select label="Placeholder"
              options=options
              optionValuePath="name"
              optionLabelPath="text"
              on-select=(action "some-action")}}

On selection, the on-select action is called with the selected object.

If you want only the ID—and not the object—you can do this:

  {{en-select label="Placeholder"
              options=options
              optionValuePath="name"
              optionLabelPath="text"
              on-select=(action (mut someValue) value="id")}}

This will set someValue to the id of the selected object.

Advanced Usage

<<<<<<< HEAD en-select can be used in the block form as well, like so:

  {{#en-select options=options on-select="some-action" as |option|}}
    {{option.label}}
  {{/en-select}}

You can also customize what shows up when no options are available (i.e. the options you pass in is an empty array, or what the user searched for has no results available). Here's how:

  {{#en-select options=options on-select="some-action" as |option|}}
    {{option.label}}
  {{else}}
    <h5>No results found</h5>
  {{/en-select}}

Options

Option | Type | Default | Explanation ----------------|--------|------------------------------|--------------- isDisabled | boolean | false | Disables the select component, adds a is-disabled class. disableSearch | boolean | false | Hides the search box if set to true canRemoveSelection | boolean | true | Allows the user to cancel the selection label | string | null | Acts as the placeholder when nothing is selected options | array | [] | An array of the list items that you want to render value | object/string | null | The current selection

Actions

Action | Explanation ----------------|------------------------------------------------------ on-select | When an option is selected, on-select action is triggered on-focus | When an option gets focus, on-focus action is triggered on-remove | When an option is removed, on-remove action is triggered

Installation

ember install en-select

License

This project is licensed under the MIT License.