GithubHelp home page GithubHelp logo

knownasilya / ember-select-light Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ember-a11y/ember-select-light

0.0 2.0 0.0 1.1 MB

The simplest Ember <select> there is.

License: Other

JavaScript 83.75% HTML 8.56% Handlebars 7.69%

ember-select-light's Introduction

Ember-Select-Light

CI PRs Welcome License: MIT npm package Ember Observer

Ember-Select-Light is an Ember Addon focused on simplicity. Just powerful enough to offer expected baseline functionality while being easy to implement, style, and make accessible.

This addon is Octane ready and follows ember-component-pattern's for how to best write a Select Element.

Getting Started

ember install ember-select-light

Example Usage

<SelectLight
  @value="turtle"
  @options={{array "turtle" "tortoise"}}
  @onChange={{action "handleChange"}} />

With an array of objects...

<SelectLight
  @options={{array
    (hash value="shortfin" label="Shortfin Shark")
    (hash value="mako" label="Mako Shark")
  }} />

value and label will be the default object keys used unless @valueKey="... and/or @displayKey="... are used respectively, like so...

<SelectLight
  @options={{array
    (hash myValue="shortfin" myLabel="Shortfin Shark")
    (hash myValue="mako" myLabel="Mako Shark")
  }}
  @valueKey="myValue"
  @displayKey="myLabel" />

As a Yield

<SelectLight>
  <option value="clown">Clown Fish</option>
  <option value="cat">Cat Fish</option>
</SelectLight>

Other arguments

Other arguments are spread onto the <select ...attributes as you'd expect, allowing you to use common attributes such as disabled, tabindex and of course class.

<SelectLight class="my-select" disabled="true" />

Styled

As shown above we can pass in other arguments like class=" which allows us to style our Select dropdowns. Below is an example with the Select dropdown styled using Tailwind CSS.

Following the Tailwind Custom Select guides this component can be easily styled


Upgrading

See the upgrading guide for how to upgrade from previous versions.


Running

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Contributing

We love pull requests from everyone. By participating in this project, you agree to abide by the code of conduct and is subject to the project license.

Clone this repo, make your changes with test coverage, push up a fork and submit a pull request.

Soon after some primary contributors will review your code and submit feedback and hopefully click the fancy green approve button. Any test and linting failures should be caught during the pull request continuous integration environment and human eyes here after.

Running Tests

  • npm run test (Runs ember try:each to test your addon against multiple Ember versions)
  • or ember test

ember-select-light's People

Contributors

hergaiety avatar joe-wroten-q2 avatar dependabot[bot] avatar david-peden-q2 avatar cah-danmonroe avatar jandillmann avatar javve avatar ember-tomster avatar colenso avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.