Skip to content
Ember ARIA switch button with accessibility
Branch: master
Clone or download
rajasegar Merge pull request #21 from rajasegar/dependabot/npm_and_yarn/ember-c…
…li-babel-7.6.0

Bump ember-cli-babel from 7.5.0 to 7.6.0
Latest commit 2a24fb2 Mar 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app
config
tests New module syntax and dependencies update Aug 6, 2018
vendor Initial Commit from Ember CLI v2.13.0-beta.3 Aug 24, 2017
.bowerrc
.coveralls.yml Added coveralls badge and config Sep 8, 2017
.editorconfig Initial Commit from Ember CLI v2.13.0-beta.3 Aug 24, 2017
.ember-cli
.eslintrc.js Initial Commit from Ember CLI v2.13.0-beta.3 Aug 24, 2017
.gitignore
.npmignore
.travis.yml
.watchmanconfig Initial Commit from Ember CLI v2.13.0-beta.3 Aug 24, 2017
LICENSE.md
README.md
ember-cli-build.js
index.js Initial Commit from Ember CLI v2.13.0-beta.3 Aug 24, 2017
package-lock.json
package.json Bump ember-ajax from 4.0.2 to 5.0.0 Mar 14, 2019
testem.js New module syntax and dependencies update Aug 6, 2018
yuidoc.json

README.md

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/.

You can’t perform that action at this time.