Vivid API

Radio Group

A radio group is a collection of Radio buttons where only one choice can be selected.

Usage

import { registerRadio, registerRadioGroup } from '@vonage/vivid-api';
registerRadio('your-prefix');
registerRadioGroup('your-prefix');

Value

Use the value attribute to set the Radio’s value.

Required

Use the required attribute to set define whether a response to the Radio Group must be provided in order to submit a form.

Below, the Radio Field is marked as required and is validated when the form is submitted.

Slots

Helper Text Slot

Use the helper-text slot on Radio Group to add rich text to provide additional context to the user.

Methods

Check Validity

You can use the checkValidity() method on one of the Radio’s to validate it. Below, the Radio Group is required but it has no checked options. checkValidity was called which triggered the validation.

API Reference

radio-group

Properties

PropertyTypeDefaultDescription
disabledbooleanWhether the input element is disabled
errorTextstring
helperTextstringProvides additional information to help the user enter the correct information. To add HTML to the helper text, use the helper-text slot instead.
labelstringLabel of the the Radio Group
namestringThe name of the radio group. Setting this value will set the name value for all child radio elements.
orientation'horizontal' | 'vertical'Sets axis on which the tabs are aligned
readOnlybooleanWhen true, the child radios will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanSets the required state
value
(modelValue)
stringThe value of the checked radio
PropertyTypeDefaultDescription
disabledbooleanWhether the input element is disabled
error-textstring
helper-textstringProvides additional information to help the user enter the correct information. To add HTML to the helper text, use the helper-text slot instead.
labelstringLabel of the the Radio Group
namestringThe name of the radio group. Setting this value will set the name value for all child radio elements.
orientation'horizontal' | 'vertical'Sets axis on which the tabs are aligned
readonlybooleanWhen true, the child radios will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanSets the required state
valuestringThe value of the checked radio

Slots

NameDescription
defaultDefault slot.
helper-textDescribes how to use the text-field. Alternative to the `helper-text` attribute.
NameDescription
defaultDefault slot.
helper-textDescribes how to use the text-field. Alternative to the `helper-text` attribute.

Events

NameTypeDescription
changeCustomEvent<undefined>Fires a custom 'change' event when the value changes
NameTypeDescription
changeCustomEvent<undefined>Fires a custom 'change' event when the value changes

Methods

NameParamsReturnsDescription
nameChangedvoid

radio

Properties

PropertyTypeDefaultDescription
checkedbooleanThe current checkedness of the element.
connotation'accent' | 'cta'The connotation the radioButton should have.
defaultCheckedbooleanThe default checkedness of the element. This value sets the `checked` property only when the `checked` property has not been explicitly set.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
errorTextstringProvides a custom error message. Any current error state will be overridden.
initialValuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringThe label for the form element.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
readOnlybooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanRequire the field to be completed prior to form submission.
valuestringThe current value of the element.
PropertyTypeDefaultDescription
current-checkedbooleanThe current checkedness of the element.
connotation'accent' | 'cta'The connotation the radioButton should have.
checkedbooleanThe default checkedness of the element. This value sets the `checked` property only when the `checked` property has not been explicitly set.
disabledbooleanSets the element's disabled state. A disabled element will not be included during form submission.
error-textstringProvides a custom error message. Any current error state will be overridden.
valuestringThe default value of the element. This value sets the `value` property only when the `value` property has not been explicitly set.
labelstringThe label for the form element.
namestringThe name of the element. This element's value will be surfaced during form submission under the provided name.
readonlybooleanWhen true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly | readonly HTML attribute for more information.
requiredbooleanRequire the field to be completed prior to form submission.
current-valuestringThe current value of the element.

Events

NameTypeDescription
changeCustomEvent<undefined>Fires a custom 'change' event when the value changes
NameTypeDescription
changeCustomEvent<undefined>Fires a custom 'change' event when the value changes

Methods

NameParamsReturnsDescription
checkValiditybooleanReturn the current validity of the element.
reportValiditybooleanReturn the current validity of the element. If false, fires an invalid event at the element.