Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-radio-button

Package Overview
Dependencies
Maintainers
4
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-radio-button

provides a radio-button component

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

ember-radio-button Build Status Ember Observer Score

This addon provides a radio-button component.

A radio-button will be in a checked state when the value property matches the groupValue property. value should be unique per radio-button, while the same groupValue should be provided to each radio-button in the group.

Clicking on a radio-button will set groupValue to its value.

Usage

Block Form

The block form emits a label wrapping the input element and any elements passed to the block.

Template:

{{#radio-button
    value="blue"
    groupValue=color
    changed=(action "colorChanged")
}}
    <span>Blue</span>
{{/radio-button}}

/* results in */
<label id="ember346" class="ember-view ember-radio-button">
  <input id="ember347" class="ember-view" type="radio" value="blue">
  <span>Blue</span>
</label>

Non-block form

If you want more control over the DOM, the non-block form only emits a single input element

{{radio-button
    value="green"
    groupValue=color
    name="colors"
    changed=(action "colorChanged")
}}

/* results in */
<input id="ember345" class="ember-view" type="radio" value="green">

Examples in the test application

More example usage can be seen in the test application.

Supported Ember Versions

ember-radio-button versionsupports
2.xEmber 2.8+
1.xEmber 1.11+

Properties

Required:

nametypedescription
valueanythe unique value represented by the radio button
groupValueanythe value representing a radio group's current value. supply the same groupValue to every radio-button in a group

Optional:

nametypedescription
ariaDescribedbystringapplies an aria-describedby attribute to the input element
ariaLabelledbystringapplies an aria-labelledby attribute to the input element
autofocusbooleanapplies the autofocus property to the input element
checkedClassstringclassname to apply to the label element when the input it wraps is checked. block form only. defaults to "checked"
classNamesstringapplies additional classnames to the label element (block form only)
disabledbooleanapplies the disabled property to the input element
namestringapplies the name property to the input element
radioClassstringapplies additional classnames to the input element
radioIdstringsets the id of the input element and the for property to the label element
requiredbooleanapplies the required property to the input element
tabindexnumberapplies a tabindex property to the input element

Actions:

namedescription
changedfires when user interaction causes a radio-button to update groupValue

Installing

ember install ember-radio-button

Legacy Action Support

A string can be supplied for the changed property to enable legacy sendAction style action propagation.

Older versions of ember

ember-radio-button 1.0.0+ requires using htmlbars. Applications not using htmlbars should use version 0.1.3 or the pre-htmlbars branch.

Collaborating on this repo

  • git clone <repository-url> this repository
  • cd ember-radio-button
  • npm install

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

Keywords

FAQs

Package last updated on 01 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc