1e41f4b71Sopenharmony_ci# Radio
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci单选框,提供相应的用户交互选择项。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  API version 12开始,Radio选中默认样式由RadioIndicatorType.DOT变为RadioIndicatorType.TICK8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci>  该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## 子组件
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## 接口
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciRadio(options: RadioOptions)
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci创建单选框组件。
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**参数:** 
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci| 参数名  | 类型                                  | 必填 | 说明               |
32e41f4b71Sopenharmony_ci| ------- | ------------------------------------- | ---- | ------------------ |
33e41f4b71Sopenharmony_ci| options | [RadioOptions](#radiooptions对象说明) | 是   | 配置单选框的参数。 |
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci## RadioOptions对象说明
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 |
40e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
41e41f4b71Sopenharmony_ci| value | string | 是 | 当前单选框的值。 <br/>**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。<br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
42e41f4b71Sopenharmony_ci| group | string | 是 | 当前单选框的所属群组名称,相同group的Radio只能有一个被选中。<br/>**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。<br/>**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。 |
43e41f4b71Sopenharmony_ci| indicatorType<sup>12+</sup> | [RadioIndicatorType](#radioindicatortype12枚举说明) | 否 | 配置单选框的选中样式。未设置时按照RadioIndicatorType.TICK进行显示。<br/>**卡片能力:** 从API version 12开始,该接口支持在ArkTS卡片中使用。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
44e41f4b71Sopenharmony_ci| indicatorBuilder<sup>12+</sup> | [CustomBuilder](ts-types.md#custombuilder8) | 否 | 配置单选框的选中样式为自定义组件。自定义组件与Radio组件为中心点对齐显示。indicatorBuilder设置为undefined时,按照RadioIndicatorType.TICK进行显示。<br/>**卡片能力:** 从API version 12开始,该接口支持在ArkTS卡片中使用。<br/>**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。 |
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci## RadioIndicatorType<sup>12+</sup>枚举说明
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci**卡片能力:** 从API version 12开始,该接口支持在ArkTS卡片中使用。
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci| 名称            | 说明                           |
55e41f4b71Sopenharmony_ci| --------------- | -------------------------------- |
56e41f4b71Sopenharmony_ci| TICK            | 选中样式为系统默认TICK图标。  |
57e41f4b71Sopenharmony_ci| DOT             | 选中样式为系统默认DOT图标。   |
58e41f4b71Sopenharmony_ci| CUSTOM          | 选中样式为indicatorBuilder中的内容。|
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci## 属性
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci### checked
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_cichecked(value: boolean)
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci设置单选框的选中状态。
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci从API version 10开始,该属性支持[$$](../../../quick-start/arkts-two-way-sync.md)双向绑定变量。
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**参数:** 
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci| 参数名 | 类型    | 必填 | 说明                                 |
81e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------ |
82e41f4b71Sopenharmony_ci| value  | boolean | 是   | 单选框的选中状态。<br/>默认值:false |
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci### radioStyle<sup>10+</sup>
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ciradioStyle(value?: RadioStyle)
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci设置单选框选中状态和非选中状态的样式。 
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci从API version 10开始,该接口支持在ArkTS组件中使用。
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ci**参数:** 
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci| 参数名 | 类型                                | 必填 | 说明                               |
99e41f4b71Sopenharmony_ci| ------ | ----------------------------------- | ---- | ---------------------------------- |
100e41f4b71Sopenharmony_ci| value  | [RadioStyle](#radiostyle10对象说明) | 否   | 单选框选中状态和非选中状态的样式。 |
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci## contentModifier<sup>12+</sup>
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_cicontentModifier(modifier: ContentModifier\<RadioConfiguration>)
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci定制Radio内容区的方法。
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci**参数:**
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci| 参数名 | 类型                                          | 必填 | 说明                                             |
115e41f4b71Sopenharmony_ci| ------ | --------------------------------------------- | ---- | ------------------------------------------------ |
116e41f4b71Sopenharmony_ci| modifier  | [ContentModifier\<RadioConfiguration>](#radioconfiguration12对象说明) | 是   | 在Radio组件上,定制内容区的方法。<br/>modifier: 内容修改器,开发者需要自定义class实现ContentModifier接口。 |
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci## 事件
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件:
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ci### onChange
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_cionChange(callback: (isChecked: boolean) => void)
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci单选框选中状态改变时触发回调。
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci**卡片能力:** 从API version 9开始,该接口支持在ArkTS卡片中使用。
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci**参数:** 
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci| 参数名    | 类型    | 必填 | 说明                                                         |
137e41f4b71Sopenharmony_ci| --------- | ------- | ---- | ------------------------------------------------------------ |
138e41f4b71Sopenharmony_ci| isChecked | boolean | 是   | 单选框的状态。<br/>为true时,表示从未选中变为选中。为false时,表示从选中变为未选中。 |
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci## RadioStyle<sup>10+</sup>对象说明
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 11开始,该接口支持在原子化服务中使用。
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci| 名称                   | 类型                                       | 必填 | 说明                                                         |
147e41f4b71Sopenharmony_ci| ---------------------- | ------------------------------------------ | ---- | ------------------------------------------------------------ |
148e41f4b71Sopenharmony_ci| checkedBackgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 否   | 开启状态底板颜色。<br/>默认值:#007DFF                       |
149e41f4b71Sopenharmony_ci| uncheckedBorderColor   | [ResourceColor](ts-types.md#resourcecolor) | 否   | 关闭状态描边颜色。<br/>默认值:#182431                       |
150e41f4b71Sopenharmony_ci| indicatorColor         | [ResourceColor](ts-types.md#resourcecolor) | 否   | 开启状态内部圆饼颜色。从API version 12开始,indicatorType设置为RadioIndicatorType.TICKRadioIndicatorType.DOT时,支持修改内部颜色。indicatorType设置为RadioIndicatorType.CUSTOM时,不支持修改内部颜色。<br/>默认值:#FFFFFF |
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci## RadioConfiguration<sup>12+</sup>对象说明
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci开发者需要自定义class实现ContentModifier接口。
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.ArkUI.ArkUI.Full
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci| 名称  | 类型    | 只读 | 可选  |  说明              |
161e41f4b71Sopenharmony_ci| ------ | ------ |-------------------------------- |-------------------------------- |-------------------------------- |
162e41f4b71Sopenharmony_ci| value | string | 否 | 否 |当前单选框的值。 |
163e41f4b71Sopenharmony_ci| checked | boolean| 否 | 否 | 设置单选框的选中状态。<br/>默认值:false |
164e41f4b71Sopenharmony_ci| triggerChange |Callback\<boolean>|否|否|触发单选框选中状态变化。 |
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci
167e41f4b71Sopenharmony_ci## 示例
168e41f4b71Sopenharmony_ci### 示例1 
169e41f4b71Sopenharmony_ci设置开启状态底板颜色。
170e41f4b71Sopenharmony_ci```ts
171e41f4b71Sopenharmony_ci// xxx.ets
172e41f4b71Sopenharmony_ci@Entry
173e41f4b71Sopenharmony_ci@Component
174e41f4b71Sopenharmony_cistruct RadioExample {
175e41f4b71Sopenharmony_ci  build() {
176e41f4b71Sopenharmony_ci    Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
177e41f4b71Sopenharmony_ci      Column() {
178e41f4b71Sopenharmony_ci        Text('Radio1')
179e41f4b71Sopenharmony_ci        Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
180e41f4b71Sopenharmony_ci          .radioStyle({
181e41f4b71Sopenharmony_ci            checkedBackgroundColor: Color.Pink
182e41f4b71Sopenharmony_ci          })
183e41f4b71Sopenharmony_ci          .height(50)
184e41f4b71Sopenharmony_ci          .width(50)
185e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
186e41f4b71Sopenharmony_ci            console.log('Radio1 status is ' + isChecked)
187e41f4b71Sopenharmony_ci          })
188e41f4b71Sopenharmony_ci      }
189e41f4b71Sopenharmony_ci      Column() {
190e41f4b71Sopenharmony_ci        Text('Radio2')
191e41f4b71Sopenharmony_ci        Radio({ value: 'Radio2', group: 'radioGroup' }).checked(false)
192e41f4b71Sopenharmony_ci          .radioStyle({
193e41f4b71Sopenharmony_ci            checkedBackgroundColor: Color.Pink
194e41f4b71Sopenharmony_ci          })
195e41f4b71Sopenharmony_ci          .height(50)
196e41f4b71Sopenharmony_ci          .width(50)
197e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
198e41f4b71Sopenharmony_ci            console.log('Radio2 status is ' + isChecked)
199e41f4b71Sopenharmony_ci          })
200e41f4b71Sopenharmony_ci      }
201e41f4b71Sopenharmony_ci      Column() {
202e41f4b71Sopenharmony_ci        Text('Radio3')
203e41f4b71Sopenharmony_ci        Radio({ value: 'Radio3', group: 'radioGroup' }).checked(false)
204e41f4b71Sopenharmony_ci          .radioStyle({
205e41f4b71Sopenharmony_ci            checkedBackgroundColor: Color.Pink
206e41f4b71Sopenharmony_ci          })
207e41f4b71Sopenharmony_ci          .height(50)
208e41f4b71Sopenharmony_ci          .width(50)
209e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
210e41f4b71Sopenharmony_ci            console.log('Radio3 status is ' + isChecked)
211e41f4b71Sopenharmony_ci          })
212e41f4b71Sopenharmony_ci      }
213e41f4b71Sopenharmony_ci    }.padding({ top: 30 })
214e41f4b71Sopenharmony_ci  }
215e41f4b71Sopenharmony_ci}
216e41f4b71Sopenharmony_ci```
217e41f4b71Sopenharmony_ci![radio](figures/radio.gif)
218e41f4b71Sopenharmony_ci### 示例2 
219e41f4b71Sopenharmony_ci设置选中样式为图片。
220e41f4b71Sopenharmony_ci```ts
221e41f4b71Sopenharmony_ci// xxx.ets
222e41f4b71Sopenharmony_ci@Entry
223e41f4b71Sopenharmony_ci@Component
224e41f4b71Sopenharmony_cistruct RadioExample {
225e41f4b71Sopenharmony_ci  @Builder 
226e41f4b71Sopenharmony_ci  indicatorBuilder() {
227e41f4b71Sopenharmony_ci    Image($r("app.media.star"))
228e41f4b71Sopenharmony_ci  }
229e41f4b71Sopenharmony_ci  build() {
230e41f4b71Sopenharmony_ci    Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
231e41f4b71Sopenharmony_ci      Column() {
232e41f4b71Sopenharmony_ci        Text('Radio1')
233e41f4b71Sopenharmony_ci        Radio({ value: 'Radio1', group: 'radioGroup',
234e41f4b71Sopenharmony_ci          indicatorType:RadioIndicatorType.TICK
235e41f4b71Sopenharmony_ci        }).checked(true)
236e41f4b71Sopenharmony_ci          .height(50)
237e41f4b71Sopenharmony_ci          .width(80)
238e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
239e41f4b71Sopenharmony_ci            console.log('Radio1 status is ' + isChecked)
240e41f4b71Sopenharmony_ci          })
241e41f4b71Sopenharmony_ci      }
242e41f4b71Sopenharmony_ci      Column() {
243e41f4b71Sopenharmony_ci        Text('Radio2')
244e41f4b71Sopenharmony_ci        Radio({ value: 'Radio2', group: 'radioGroup',
245e41f4b71Sopenharmony_ci          indicatorType:RadioIndicatorType.DOT
246e41f4b71Sopenharmony_ci        }).checked(false)
247e41f4b71Sopenharmony_ci          .height(50)
248e41f4b71Sopenharmony_ci          .width(80)
249e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
250e41f4b71Sopenharmony_ci            console.log('Radio2 status is ' + isChecked)
251e41f4b71Sopenharmony_ci          })
252e41f4b71Sopenharmony_ci      }
253e41f4b71Sopenharmony_ci      Column() {
254e41f4b71Sopenharmony_ci        Text('Radio3')
255e41f4b71Sopenharmony_ci        Radio({ value: 'Radio3', group: 'radioGroup',
256e41f4b71Sopenharmony_ci          indicatorType:RadioIndicatorType.CUSTOM,
257e41f4b71Sopenharmony_ci          indicatorBuilder:()=>{this.indicatorBuilder()}
258e41f4b71Sopenharmony_ci        }).checked(false)
259e41f4b71Sopenharmony_ci          .height(50)
260e41f4b71Sopenharmony_ci          .width(80)
261e41f4b71Sopenharmony_ci          .onChange((isChecked: boolean) => {
262e41f4b71Sopenharmony_ci            console.log('Radio3 status is ' + isChecked)
263e41f4b71Sopenharmony_ci          })
264e41f4b71Sopenharmony_ci      }
265e41f4b71Sopenharmony_ci    }.padding({ top: 30 })
266e41f4b71Sopenharmony_ci  }
267e41f4b71Sopenharmony_ci}
268e41f4b71Sopenharmony_ci```
269e41f4b71Sopenharmony_ci![radio](figures/radio_2.gif)
270e41f4b71Sopenharmony_ci### 示例3
271e41f4b71Sopenharmony_ci设置自定义单选样式。
272e41f4b71Sopenharmony_ci```ts
273e41f4b71Sopenharmony_ciclass MyRadioStyle implements ContentModifier<RadioConfiguration> {
274e41f4b71Sopenharmony_ci  type: number = 0
275e41f4b71Sopenharmony_ci  selectedColor: ResourceColor = Color.Black
276e41f4b71Sopenharmony_ci
277e41f4b71Sopenharmony_ci  constructor(numberType: number, colorType: ResourceColor) {
278e41f4b71Sopenharmony_ci    this.type = numberType
279e41f4b71Sopenharmony_ci    this.selectedColor = colorType
280e41f4b71Sopenharmony_ci  }
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ci  applyContent(): WrappedBuilder<[RadioConfiguration]> {
283e41f4b71Sopenharmony_ci    return wrapBuilder(buildRadio)
284e41f4b71Sopenharmony_ci  }
285e41f4b71Sopenharmony_ci}
286e41f4b71Sopenharmony_ci
287e41f4b71Sopenharmony_ci@Builder
288e41f4b71Sopenharmony_cifunction buildRadio(config: RadioConfiguration) {
289e41f4b71Sopenharmony_ci  Row({ space: 30 }) {
290e41f4b71Sopenharmony_ci    Circle({ width: 50, height: 50 })
291e41f4b71Sopenharmony_ci      .stroke(Color.Black)
292e41f4b71Sopenharmony_ci      .fill(config.checked ? (config.contentModifier as MyRadioStyle).selectedColor : Color.White)
293e41f4b71Sopenharmony_ci    Button(config.checked ? "off" : "on")
294e41f4b71Sopenharmony_ci      .width(100)
295e41f4b71Sopenharmony_ci      .type(config.checked ? (config.contentModifier as MyRadioStyle).type : ButtonType.Normal)
296e41f4b71Sopenharmony_ci      .backgroundColor('#2787D9')
297e41f4b71Sopenharmony_ci      .onClick(() => {
298e41f4b71Sopenharmony_ci        if (config.checked) {
299e41f4b71Sopenharmony_ci          config.triggerChange(false)
300e41f4b71Sopenharmony_ci        } else {
301e41f4b71Sopenharmony_ci          config.triggerChange(true)
302e41f4b71Sopenharmony_ci        }
303e41f4b71Sopenharmony_ci      })
304e41f4b71Sopenharmony_ci  }
305e41f4b71Sopenharmony_ci}
306e41f4b71Sopenharmony_ci
307e41f4b71Sopenharmony_ci@Entry
308e41f4b71Sopenharmony_ci@Component
309e41f4b71Sopenharmony_cistruct refreshExample {
310e41f4b71Sopenharmony_ci  build() {
311e41f4b71Sopenharmony_ci    Column({ space: 50 }) {
312e41f4b71Sopenharmony_ci      Row() {
313e41f4b71Sopenharmony_ci        Radio({ value: 'Radio1', group: 'radioGroup' })
314e41f4b71Sopenharmony_ci          .contentModifier(new MyRadioStyle(1, '#004AAF'))
315e41f4b71Sopenharmony_ci          .checked(false)
316e41f4b71Sopenharmony_ci          .width(300)
317e41f4b71Sopenharmony_ci          .height(100)
318e41f4b71Sopenharmony_ci      }
319e41f4b71Sopenharmony_ci
320e41f4b71Sopenharmony_ci      Row() {
321e41f4b71Sopenharmony_ci        Radio({ value: 'Radio2', group: 'radioGroup' })
322e41f4b71Sopenharmony_ci          .checked(true)
323e41f4b71Sopenharmony_ci          .width(300)
324e41f4b71Sopenharmony_ci          .height(60)
325e41f4b71Sopenharmony_ci          .contentModifier(new MyRadioStyle(2, '#004AAF'))
326e41f4b71Sopenharmony_ci      }
327e41f4b71Sopenharmony_ci    }
328e41f4b71Sopenharmony_ci  }
329e41f4b71Sopenharmony_ci}
330e41f4b71Sopenharmony_ci```
331e41f4b71Sopenharmony_ci![](figures/radio_3.gif)