1e41f4b71Sopenharmony_ci# input
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciThe **\<input>** component provides a radio button to receive user input. 
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci> **NOTE**
7e41f4b71Sopenharmony_ci>
8e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Attributes
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-service-widget-common-attributes.md), the following attributes are supported.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci| Name     | Type     | Default Value  | Mandatory  | Description                                      |
15e41f4b71Sopenharmony_ci| ------- | ------- | ----- | ---- | ---------------------------------------- |
16e41f4b71Sopenharmony_ci| type    | string  | radio | Yes   | Type of the **\<input>** component. Currently, only the radio button is supported.<br>- **radio**: a radio button that allows users to select one from multiple others with the same name.|
17e41f4b71Sopenharmony_ci| checked | boolean | false | No   | Whether the component is checked or not.                               |
18e41f4b71Sopenharmony_ci| name    | string  | -     | No   | Name of the **\<input>** component.                             |
19e41f4b71Sopenharmony_ci| value   | string  | -     | No   | Value of the **<input>** component. When **type** is **radio**, this attribute is mandatory and the value must be unique for radio buttons with the same name.|
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci## Styles
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ciThe [universal styles](js-service-widget-common-styles.md) are supported.
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci## Events
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci| Name    | Parameter                | Description                                      |
30e41f4b71Sopenharmony_ci| ------ | ------------------ | ---------------------------------------- |
31e41f4b71Sopenharmony_ci| change | $event.checkedItem | Triggered when the **checked** status of a radio button changes. This event returns the value of the selected **\<input>** component.|
32e41f4b71Sopenharmony_ci| click  | -                  | Triggered when the component is clicked.                              |
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci## Example
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci```html
39e41f4b71Sopenharmony_ci<!-- xxx.hml -->
40e41f4b71Sopenharmony_ci<div class="content">
41e41f4b71Sopenharmony_ci  <input type="radio" checked='true' name="radioSample" value="radio1" onchange="onRadioChange"></input>
42e41f4b71Sopenharmony_ci  <input type="radio" checked='false' name="radioSample" value="radio2" onchange="onRadioChange"></input>
43e41f4b71Sopenharmony_ci  <input type="radio" checked='false' name="radioSample" value="radio3" onchange="onRadioChange"></input>
44e41f4b71Sopenharmony_ci</div>
45e41f4b71Sopenharmony_ci```
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci```css
49e41f4b71Sopenharmony_ci/* xxx.css */
50e41f4b71Sopenharmony_ci.content{
51e41f4b71Sopenharmony_ci  width: 100%;
52e41f4b71Sopenharmony_ci  height: 200px;
53e41f4b71Sopenharmony_ci  justify-content: center;
54e41f4b71Sopenharmony_ci  align-items: center;
55e41f4b71Sopenharmony_ci}
56e41f4b71Sopenharmony_ci```
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci```json
60e41f4b71Sopenharmony_ci{
61e41f4b71Sopenharmony_ci  "actions": {
62e41f4b71Sopenharmony_ci    "onRadioChange":{
63e41f4b71Sopenharmony_ci      "action": "message",
64e41f4b71Sopenharmony_ci      "params": {
65e41f4b71Sopenharmony_ci        "checkedRadio": "$event.checkedItem"
66e41f4b71Sopenharmony_ci      }
67e41f4b71Sopenharmony_ci    }
68e41f4b71Sopenharmony_ci  }
69e41f4b71Sopenharmony_ci}
70e41f4b71Sopenharmony_ci```
71e41f4b71Sopenharmony_ci**4 x 4 widget**
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci![input](figures/input.gif)
74