material-web/packages/radio
2019-08-21 11:28:34 -07:00
..
images Add README for <mwc-radio> (#377) 2019-08-16 14:02:29 -07:00
src ran formatter & fixed lint 2019-08-21 11:28:34 -07:00
.npmignore Add an .npmignore to every package. 2019-08-13 10:24:31 -07:00
package.json chore: add repository.directory in package.json for all packages 2019-07-17 00:54:39 +03:00
README.md Add README for <mwc-radio> (#377) 2019-08-16 14:02:29 -07:00
tsconfig.json Update dependencies 2019-04-04 15:36:55 -07:00

<mwc-radio> Published on npm

IMPORTANT: The Material Web Components are a work in progress and subject to major changes until 1.0 release.

Radio buttons allow the user to select one option from a set. Use radio buttons when the user needs to see all available options.

Material Design Guidelines: Radio buttons

Installation

npm install @material/mwc-radio

NOTE: The Material Web Components are distributed as ES2017 JavaScript Modules, and use the Custom Elements API. They are compatible with all modern browsers including Chrome, Firefox, Safari, Edge, and IE11, but an additional tooling step is required to resolve bare module specifiers, as well as transpilation and polyfills for Edge and IE11. See here for detailed instructions.

Example usage

Standard

<mwc-radio name="myGroup" value="value1"></mwc-radio>
<mwc-radio name="myGroup" value="value2" checked></mwc-radio>

<script type="module">
  import '@material/mwc-radio';
</script>

Custom color

mwc-radio {
  --mdc-theme-secondary: #ff4081;
}

API

Slots

None

Properties/Attributes

Name Type Default Description
checked boolean false Whether this radio button is the currently-selected one in its group. Maps to the native checked attribute.
disabled boolean false If true, this radio button cannot be selected or de-selected. Maps to the native disabled attribute.
name string '' Name of the input for form submission, and identifier for the selection group. Only one radio button can be checked for a given selection group. Maps to the native name attribute.
value string '' Value of the input for form submission. Maps to the native value attribute.

Methods

None

Events

Name Detail Description
change {} Indicates that the radio button's checked state has changed.

CSS Custom Properties

Name Default Description
--mdc-theme-secondary #018786 Color of the radio button.

Additional references