跳到主要内容
版本:v8

单选按钮组组件

单选按钮组是用于容纳一组单选按钮的容器。它允许用户从一组选项中选择最多一个。选中属于同一单选按钮组中的某个按钮时,之前在该组内选中的任何其他按钮都会自动取消选中。关于单选按钮组的具体用法示例,请参阅单选按钮文档。

接口

RadioGroupChangeEventDetail

interface RadioGroupChangeEventDetail<T = any> {
value: T;
}

RadioGroupCustomEvent

虽然不强制使用,但可以用此接口替代 CustomEvent 接口,以便在使用该组件发出的 Ionic 事件时获得更强的类型支持。

interface RadioGroupCustomEvent<T = any> extends CustomEvent {
detail: RadioGroupChangeEventDetail<T>;
target: HTMLIonRadioGroupElement;
}

属性

allowEmptySelection

DescriptionIf true, the radios can be deselected.
Attributeallow-empty-selection
Typeboolean
Defaultfalse

compareWith

DescriptionThis property allows developers to specify a custom function or property name for comparing objects when determining the selected option in the ion-radio-group. When not specified, the default behavior will use strict equality (===) for comparison.
Attributecompare-with
Type((currentValue: any, compareValue: any) => boolean) | null | string | undefined
Defaultundefined

errorText

DescriptionThe error text to display at the top of the radio group.
Attributeerror-text
Typestring | undefined
Defaultundefined

helperText

DescriptionThe helper text to display at the top of the radio group.
Attributehelper-text
Typestring | undefined
Defaultundefined

name

DescriptionThe name of the control, which is submitted with the form data.
Attributename
Typestring
Defaultthis.inputId

value

Descriptionthe value of the radio group.
Attributevalue
Typeany
Defaultundefined

事件

NameDescriptionBubbles
ionChangeEmitted when the value has changed.

This event will not emit when programmatically setting the value property.
true

方法

No public methods available for this component.

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS 自定义属性

No CSS custom properties available for this component.

插槽

No slots available for this component.