1.5.0 • Published 5 years ago

en-select v1.5.0

Weekly downloads
22
License
MIT
Repository
github
Last release
5 years ago

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

OptionTypeDefaultExplanation
isDisabledbooleanfalseDisables the select component, adds a is-disabled class.
disableSearchbooleanfalseHides the search box if set to true
canRemoveSelectionbooleantrueAllows the user to cancel the selection
labelstringnullActs as the placeholder when nothing is selected
optionsarray[]An array of the list items that you want to render
valueobject/stringnullThe current selection

Actions

ActionExplanation
on-selectWhen an option is selected, on-select action is triggered
on-focusWhen an option gets focus, on-focus action is triggered
on-removeWhen an option is removed, on-remove action is triggered

Installation

ember install en-select

License

This project is licensed under the MIT License.

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.5

6 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.7.7

7 years ago

0.7.6

7 years ago

0.7.5

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.8

8 years ago

0.5.7

8 years ago

0.5.6

8 years ago

0.5.5

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.0

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago