Skip to main content

Radio Group

<gstock-radio-group> | GstockRadioGroup

API

Properties

Name Description Reflects Type Default
form By default, form controls are associated with the nearest containing <form> element. This attribute allows you to place the form control outside of a form and associate it with the form that has this id. The form must be in the same document or shadow root for this to work. Reflects string ''
label The radio group’s label. Required for proper accessibility. If you need to display HTML, use the label slot instead. string ''
helpText
help-text
The radio groups’s help text. If you need to display HTML, use the help-text slot instead. string ''
name The name of the input, submitted as a name/value pair with form data. string 'option'
required Indicate if it is mandatory, select an option. True or false. Reflects boolean false
size The radio group’s size. This size will be applied to all child radios and radio buttons. Reflects 'small' | 'medium' | 'large' 'medium'
value The current value of the input, submitted as a name/value pair with form data. Reflects string ''
validity Gets the validity state object - -
validationMessage Gets the validation message - -
updateComplete

A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties .

Events

Name React Event Description Event Detail
gstock-change-event onGstockChangeEvent Emitted when the radio group’s selected value changes. -
gstock-input-event onGstockInputEvent Emitted when the radio group receives user input. -
gstock-invalid-event onGstockInvalidEvent Emitted when the form control has been checked for validity and its constraints aren’t satisfied. -

Learn more about events .

Slots

Name Description
default The default slot where <gstock-radio> or <gstock-radio-button> elements are placed.
label The radio group’s label. Required for proper accessibility. Alternatively, you can use the label attribute.
help-text Text that describes how to use the radio group. Alternatively, you can use the help-text attribute.

Learn more about slots .

Methods

Name Description
checkValidity( ) Checks for validity but does not show a validation message. Returns true when valid and false when invalid.
getForm( ) Gets the associated form, if one exists.
reportValidity( ) Checks for validity and shows the browser’s validation message if the control is invalid.
setCustomValidity(
message: string
)
Sets a custom validation message. Pass an empty string to restore validity.

Learn more about methods .

CSS Parts

Name Description
form-control The form control that wraps the label, input, and help text.
form-control-label The label’s wrapper.
form-control-input The input’s wrapper.
form-control-help-text The help text’s wrapper.
button-group The button group that wraps radio buttons.
button-group__base The button group’s base part.

Learn more about CSS parts .

Dependencies

This component automatically imports the following dependencies.