Skip to main content

ion-radio-group

单选组是一个容纳一组单选按钮的容器。它允许用户从一组中最多选择一个单选按钮。选中属于某个单选组的单选按钮会取消该组中之前选中的任何单选按钮。有关单选组的示例用法,请参见单选按钮文档。

🌐 A radio group is a container for a group of radios. It allows a user to select at most one radio button from a set. Checking one radio button that belongs to a radio group unchecks any previous checked radio button within the same group. For example usage of the radio group, see the radio documentation.

接口

🌐 Interfaces

RadioGroupChangeEventDetail

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

RadioGroupCustomEvent

虽然不是必需的,但可以使用此接口替代 CustomEvent 接口,以便对从此组件发出的 Ionic 事件进行更强类型的处理。

🌐 While not required, this interface can be used in place of the CustomEvent interface for stronger typing with Ionic events emitted from this component.

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

属性

🌐 Properties

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

事件

🌐 Events

NameDescriptionBubbles
ionChangeEmitted when the value has changed.

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

方法

🌐 Methods

No public methods available for this component.

CSS 阴影部分

🌐 CSS Shadow Parts

No CSS shadow parts available for this component.

CSS 自定义属性

🌐 CSS Custom Properties

No CSS custom properties available for this component.

插槽

🌐 Slots

No slots available for this component.