Skip to main content

RadioGroup

shadow

RadioGroup serves as a container for a group of radio buttons. Allows users to select one option from a set of options, ensuring that only one radio button within a group is selected at any given time. The component supports the inline attribute, which, when set, arranges the radio buttons in a horizontal layout. In addition, it programmatically manages the value attribute, which reflects the value of the currently selected radio button.

When to use

Use wje-radio-group when users need to enter values, choose options, or trigger form-related actions.

When not to use

Do not use it as a decorative element without interaction. Prefer presentational components in that case.

Accessibility

Always provide a label (label/aria-label), keep keyboard support, and surface clear validation feedback.

Best Practices

  • Keep validation rules and error behavior consistent across the entire form.
  • Show loading or disabled states during async operations.
  • Split complex forms into smaller sections with immediate feedback.

Attributes and Properties

required

DescriptionGetter for the name attribute.
Attributerequired
Typeboolean
Default-

value

DescriptionGetter for the value attribute.
Attributevalue
Typestring
Default-

disabled

DescriptionDisables user interaction with the component.
Attributedisabled
Typeany
Default-

invalid

DescriptionControls validation or status messaging for invalid.
Attributeinvalid
Typeboolean
Defaultfalse

label

DescriptionGetter for the label attribute.
Attributelabel
Typestring|null
Default-

Events

NameDescription
wje-radio-group:changeEmitted when the component value changes.

Methods

getRadioByValue

DescriptionReturns the radio button with the given value.
Signature(value: string) => Radio

removeCheck

DescriptionRemoves the check from all radio buttons.
Signature() => void

checkRadio

DescriptionSets the given radio button to checked.
Signature(radio: any) => void

getAllElements

DescriptionRetrieves all direct child elements of the current element.
Signature() => HTMLElement[]

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

NameDescription
defaultThe default slot for the radio group.