NeXTSTEP Programming Mastermind

ember-aria-switch

1.0.1 • Public • Published

ember-aria-switch

Build Status Coverage Status npm npm version dependencies Status devDependencies Status EmberObserver

ARIA Switch button in an Ember addon

Demo

Demo

Installation

  • ember install ember-aria-switch

Usage

Example Markup:

{{aria-switch label="My Label" checked=true}}

With external label

 
<p id="ex_label">
  Item 2
</p>
{{aria-switch ariaLabelledBy="ex_label"}}

With disabled state

{{aria-switch label="My Label" disabled=true}}
 

Without aria-label

{{aria-switch}}

With custom on/off labels

{{aria-switch onLabel="Yes" offLabel="No"}}

With toggle callback

{{aria-switch onToggle=(action 'toggleCallback')}}
 

And your toggleCallback can be defined such as:

export default Ember.Controller.extend({
  actions: {
    toggleCallback(toggleValue) {
      let val = toggleValue ? "ON" : "OFF";
      alert(`ARIA Switch: You turned me ${val}!`);
    }
  }
});
 

Running

Running Tests

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

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

install

npm i ember-aria-switch

Downloadsweekly downloads

16

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability