2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
11 `paper-radio-button` is a button that can be either checked or unchecked.
12 User can tap the radio button to check it. But it cannot be unchecked by
15 Use `paper-radio-group` to group a set of radio buttons. When radio buttons
16 are inside a radio group, only one radio button in the group can be checked.
20 <paper-radio-button></paper-radio-button>
24 To change the ink color for checked state:
26 paper-radio-button::shadow #ink[checked] {
30 To change the radio checked color:
32 paper-radio-button::shadow #onRadio {
33 background-color: #4285f4;
36 paper-radio-button[checked]::shadow #offRadio {
37 border-color: #4285f4;
40 To change the ink color for unchecked state:
42 paper-radio-button::shadow #ink {
46 To change the radio unchecked color:
48 paper-radio-button::shadow #offRadio {
49 border-color: #b5b5b5;
53 @element paper-radio-button
57 <link rel=
"import" href=
"../paper-ripple/paper-ripple.html">
58 <link rel=
"import" href=
"../core-a11y-keys/core-a11y-keys.html">
60 <polymer-element name=
"paper-radio-button" role=
"radio" tabindex=
"0" aria-checked=
"false">
63 <link rel=
"stylesheet" href=
"paper-radio-button.css">
65 <core-a11y-keys target=
"{{}}" keys=
"space" on-keys-pressed=
"{{tap}}"></core-a11y-keys>
67 <div id=
"radioContainer" class=
"{{ {labeled: label} | tokenList }}">
69 <div id=
"offRadio"></div>
70 <div id=
"onRadio"></div>
72 <paper-ripple id=
"ink" class=
"circle recenteringTouch" checked?=
"{{!checked}}"></paper-ripple>
76 <div id=
"radioLabel" aria-hidden=
"true" hidden?=
"{{!label}}">{{label}}
<content></content></div>
81 Polymer('paper-radio-button', {
84 * Fired when the checked state changes due to user interaction.
90 * Fired when the checked state changes.
97 * Gets or sets the state, `true` is checked and `false` is unchecked.
103 checked
: {value
: false, reflect
: true},
106 * The label for the radio button.
115 * Normally the user cannot uncheck the radio button by tapping once
116 * checked. Setting this property to `true` makes the radio button
117 * toggleable from checked to unchecked.
126 * If true, the user cannot interact with this element.
128 * @attribute disabled
132 disabled
: {value
: false, reflect
: true}
143 var old
= this.checked
;
145 if (this.checked
!== old
) {
151 this.checked
= !this.toggles
|| !this.checked
;
154 checkedChanged: function() {
155 this.setAttribute('aria-checked', this.checked
? 'true' : 'false');
156 this.fire('core-change');
159 labelChanged: function() {
160 this.setAttribute('aria-label', this.label
);