Lion Logo Lion Fundamentals Guides Components Blog Toggle darkmode

Radio Group: API Table

class: LionRadio, lion-radio

Fields

NamePrivacyTypeDefaultDescriptionInherited From
allowCrossRootRegistrationpublicbooleanfalseTo encourage accessibility best practices, `form-element-register` events do not pierce through shadow roots. This forces the developer to create form groups and fieldsets that automatically allow the creation of accessible relationships in the same dom tree. Use this option if you know what you're doing. It will then be possible to nest FormControls inside shadow dom. See https://lion.js.org/fundamentals/rationales/accessibility/#shadow-roots-and-accessibilityLionField
autocompletepublicstring | undefinedundefinedDelegates this property to input/textarea/select.NativeTextFieldMixin
autofocuspublicbooleanfalseLionField
checkedpublicbooleanChoiceInputMixin
choiceValuepublicstring|anyThe value that will be registered to the modelValue of the parent ChoiceGroup. Recommended to be a stringChoiceInputMixin
defaultValidatorspublicValidator[][]Used by Subclassers to add default Validators to a particular FormControl. A date input for instance, always needs the isDate validator.LionField
dirtypublicbooleanfalseTrue when user has changed the value of the field.LionField
disabledpublicbooleanfalseBoolean indicating whether or not this element is disabled.LionField
fieldNamepublicstringWill be used in validation messages to refer to the current fieldLionField
filledpublicbooleanfalseTrue when the modelValue is non-empty (see _isEmpty in FormControlMixin)LionField
focusedpublicbooleanfalseWhether the focusable element within (`._focusableNode`) is focused. Reflects to attribute '[focused]' as a styling hookLionField
focusedVisiblepublicbooleanfalseWhether the focusable element within (`._focusableNode`) matches ':focus-visible' Reflects to attribute '[focused-visible]' as a styling hook See: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visibleLionField
formatOnprotectedstring'change'Event that will trigger formatting (more precise, visual update of the view, so the user sees the formatted value) Default: 'change'LionField
formatOptionspublic({ mode: 'auto' })Configuration object that will be available inside the formatter functionLionField
formattedValuepublicstring|undefinedundefinedThe view value is the result of the formatter function (when available). The result will be stored in the native _inputNode (usually an input[type=text]). Examples: - For a date input, this would be '20/01/1999' (dependent on locale). - For a number input, this could be '1,234.56' (a String representation of modelValue 1234.56)LionField
hasFeedbackForpublicValidationType[][]As soon as validation happens (after modelValue/validators/validator param change), this array is updated with the active ValidationTypes ('error'|'warning'|'success'|'info' etc.). Notice the difference with `.showsFeedbackFor`, which filters `.hasFeedbackFor` based on `.feedbackCondition()`. For styling purposes, will be reflected to [has-feedback-for="error warning"]. This can be useful for subtle visual feedback on keyup, like a red/green border around an input.LionField
helpTextpublicstring''The helpt text for the input node. When no value is defined, textContent of [slot=help-text] will be usedLionField
isPendingpublicbooleanfalseFlag indicating whether async validation is pending. Creates attribute [is-pending] as a styling hookLionField
labelpublicstring''The label text for the input node. When no value is defined, textContent of [slot=label] will be usedLionField
labelSrOnlypublicbooleanfalseThe label will only be visible for srceen readers when trueLionField
modelValuepublic{value:string|any,checked:boolean}{ value: '', checked: false }Whereas 'normal' `.modelValue`s usually store a complex/typed version of a view value, choice inputs have a slightly different approach. In order to remain their Single Source of Truth characteristic, choice inputs store both the value and 'checkedness', in the format { value: 'x', checked: true } Different from the platform, this also allows to serialize the 'non checkedness', allowing to restore form state easily and inform the server about unchecked options.LionField
namepublicstring''The name the element will be registered with to the .formElements collection of the parent. Also, it serves as the key of key/value pairs in modelValue/serializedValue objectsLionField
operationModepublicOperationModeTypes of input interaction of the FormControl (for instance 'enter'|'select'|'upload')LionField
placeholderpublicstring''LionInput
prefilledpublicbooleanfalseTrue when user has left non-empty field or input is prefilled. The name must be seen from the point of view of the input field: once the user enters the input field, the value is non-empty.LionField
readOnlypublicbooleanfalseA Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input. The difference between disabled and readonly is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)LionField
selectionEndpublicnumberNativeTextFieldMixin
selectionStartpublicnumberNativeTextFieldMixin
serializedValuepublicstring|undefinedundefinedThe serialized version of the model value. This value exists for maximal compatibility with the platform API. The serialized value can be an interface in context where data binding is not supported and a serialized string needs to be set. Examples: - For a date input, this would be the iso format of a date, e.g. '1999-01-20'. - For a number input this would be the String representation of a float ('1234.56' instead of 1234.56) When no parser is available, the value is usually the same as the formattedValue (being _inputNode.value)LionField
showsFeedbackForpublicValidationType[][]Based on outcome of feedbackCondition, this array decides what ValidationTypes should be shown in validationFeedback, based on meta data like interaction states. For styling purposes, it reflects it `[shows-feedback-for="error warning"]`LionField
slotspublicAdds "._feedbackNode" as described belowLionField
submittedpublicLionField
touchedpublicbooleanfalseTrue when user has focused and left(blurred) the field.LionField
typepublicstring'text'LionInput
validationStatespublicValidationStates{}The outcome of a validation 'round'. Keyed by ValidationType and Validator nameLionField
validatorspublicValidator[][]Used by Application Developers to add Validators to a FormControl.LionField
valuepublicThe view value. Will be delegated to `._inputNode.value`LionField
_allValidatorsprotectedValidator[]Combination of validators provided by Application Developer and the default validatorsLionField
_ariaDescribedNodespublicHTMLElement[][]Contains all elements that should end up in aria-describedby of `._inputNode`LionField
_ariaLabelledNodespublicHTMLElement[][]Contains all elements that should end up in aria-labelledby of `._inputNode`LionField
_feedbackConditionMetaprotectedAllows Subclassers to add meta info for feedbackConditionLionField
_feedbackNodeprotectedElement where validation feedback will be rendered toLionField
_focusableNodeprotectedHTMLElementThe focusable element: could be an input, textarea, select, button or any other element with tabindex > -1LionField
_helpTextNodeprotectedElement where help text will be rendered toLionField
_inputIdprotectedstringUnique id that can be used in all light domLionField
_inputNodeprotectedHTMLInputElement | HTMLTextAreaElementThe interactive (form) element. Can be a native element like input/textarea/select or an element with tabindex > -1LionField
_isHandlingUserInputprotectedbooleanfalseFlag that will be set when user interaction takes place (for instance after an 'input' event). Will be added as meta info to the `model-value-changed` event. Depending on whether a user is interacting, formatting logic will be handled differently.LionField
_isPastingprotectedbooleanfalseWhether the user is pasting content. Allows Subclassers to do this in their subclass:LionField
_isRepropagationEndpointpublicbooleanfalseBy default, a field with _repropagationRole 'choice-group' will act as an 'endpoint'. This means it will be considered as an individual field: for a select, individual options will not be part of the formPath. They will. Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise' (from Application Developer perspective) need to be more like fields (think of an amount-input with a currency select box next to it), can set this to true to hide private internals in the formPath.LionField
_labelNodeprotectedElement where label will be rendered toLionField
_leaveEventprotectedstring'blur'The event that triggers the touched stateLionField
_parentFormGroupprotectedFormRegistrarHost | undefinedundefinedThe registrar this FormControl registers to, Usually a descendant of FormGroup or ChoiceGroupLionField
_repropagationRolepublic'child'|'choice-group'|'fieldset''child'Based on the role, details of handling model-value-changed repropagation differ.LionField
_requestedToBeDisabledprotectedbooleanfalseLionField
_valueChangedEventprotectedstring'model-value-changed'The event that triggers the dirty stateLionField
_visibleMessagesAmountprotectednumber1The amount of feedback messages that will visible in LionValidationFeedbackLionField

Methods

NamePrivacyDescriptionParametersReturnInherited From
addToAriaDescribedBypublicAllows to add element references to aria-describedby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}LionField
addToAriaLabelledBypublicAllows to add extra element references to aria-labelledby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}LionField
attachShadowpublicoptions: ShadowRootInitShadowRootLionField
blurpublicCalls `blur()` on focusable element withinLionField
clearpublicClears modelValue. Interaction states are not cleared (use resetInteractionState for this)LionField
clickpublicLionField
createScopedElementpublictagNameLionField
defineScopedElementpublicDefines a scoped element.tagName: string, classToBeRegistered: typeof HTMLElementLionField
deserializerpublicConverts `.serializedValue` to `.modelValue` For instance, an iso formatted date string to a Date objectv: ??LionField
feedbackConditionpublicAllows the Application Developer to specify when a feedback message should be showntype: string, meta: object, currentCondition: ((type: string, meta: object) => boolean)booleanLionField
focuspublicCalls `focus()` on focusable element withinLionField
formatterpublicConverts modelValue to formattedValue (formattedValue will be synced with `._inputNode.value`) For instance, a Date object to a localized date.modelValue: ChoiceInputModelValuestringLionField
initInteractionStatepublicEvaluations performed on connectedCallback. This method is public, so it can be called at a later moment (when we need to wait for registering children for instance) as well. Since this method will be called twice in last mentioned scenario, it must stay idempotent.LionField
makeRequestToBeDisabledpublicLionField
parserpublicConverts viewValue to modelValue For instance, a localized date to a Date Objectv: string, opts: FormatOptions*LionField
preprocessorpublicPreprocessors could be considered 'live formatters'. Their result is shown to the user on keyup instead of after blurring the field. The biggest difference between preprocessors and formatters is their moment of execution: preprocessors are run before modelValue is computed (and work based on view value), whereas formatters are run after the parser (and are based on modelValue) Automatically formats code while typing. It depends on a preprocessro that smartly updates the viewValue and caret position for best UX.v: string, opts: FormatOptions & { prevViewValue: string; currentCaretIndex: number }{ viewValue:string; caretIndex:number; }|string|undefinedLionField
removeFromAriaDescribedBypublicAllows to remove element references from aria-describedby attribute.element: HTMLElementLionField
removeFromAriaLabelledBypublicAllows to remove element references from aria-labelledby attribute.element: HTMLElementLionField
resetpublicResets modelValue to initial value. Interaction states are clearedLionField
resetInteractionStatepublicResets touched and dirty, and recomputes prefilledLionField
retractRequestToBeDisabledpublicLionField
serializerpublicConverts `.modelValue` to `.serializedValue` For instance, a Date object to an iso formatted date stringv: ?stringLionField
updateSyncpublicAn abstraction that has the exact same api as `requestUpdate`, but taking into account: - [member order independence](https://github.com/webcomponents/gold-standard/wiki/Member-Order-Independence) - property effects start when all (light) dom has initialized (on firstUpdated) - property effects don't interrupt the first meaningful paint - compatible with propertyAccessor.`hasChanged`: no manual checks needed or accidentally run property effects / events when no change happened effects when values didn't change All code previously present in requestUpdate can be placed in this method.name: string, oldValue: ?LionField
validatepublicTriggered by: - modelValue change - change in the 'validators' array - change in the config of an individual Validator Three situations are handled: - a1) the FormControl is empty: further execution is halted. When the Required Validator (being mutually exclusive to the other Validators) is applied, it will end up in the validation result (as the only Validator, since further execution was halted). - a2) there are synchronous Validators: this is the most common flow. When modelValue hasn't changed since last async results were generated, 'sync results' are merged with the 'async results'. - a3) there are asynchronous Validators: for instance when server side evaluation is needed. Executions are scheduled and awaited and the 'async results' are merged with the 'sync results'. - b) there are MetaValidators. After steps a1, a2, or a3 are finished, the holistic MetaValidators (evaluating the total result of the 'regular' (a1, a2 and a3) validators) will be run... Situations a2 and a3 are not mutually exclusive and can be triggered within one `validate()` call. Situation b will occur after every call.{ clearCurrentResult = false }, opts: { clearCurrentResult?: boolean }LionField
_afterTemplateprotectedChoiceInputMixin
_calculateValuesprotectedResponsible for storing all representations(modelValue, serializedValue, formattedValue and value) of the input value. Prevents infinite loops, so all value observers can be treated like they will only be called once, without indirectly calling other observers. (in fact, some are called twice, but the __preventRecursiveTrigger lock prevents the second call from having effect).{ source }, config: {source:'model'|'serialized'|'formatted'|null}LionField
_choiceGraphicTemplateprotectedChoiceInputMixin
_connectSlotMixinprotectedLionField
_dispatchInitialModelValueChangedEventprotectedLionField
_dispatchModelValueChangedEventprotectedThis is wrapped in a distinct method, so that parents can control when the changed event is fired. For objects, a deep comparison might be needed.args: { modelValue: unknown; }[]LionField
_enhanceLightDomA11yprotectedLionField
_enhanceLightDomA11yForAdditionalSlotsprotectedEnhances additional slots(prefix, suffix, before, after) defined by developer. When boolean attribute data-label or data-description is found, the slot element will be connected to the input via aria-labelledby or aria-describedbyadditionalSlots: string[]LionField
_enhanceLightDomClassesprotectedLionField
_feedbackTemplateprotectedTemplateResultLionField
_getAriaDescriptionElementsprotectedThis function exposes descripion elements that a FormGroup should expose to its children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()Array.<HTMLElement>LionField
_groupOneTemplateprotectedTemplateResultLionField
_groupTwoTemplateprotectedTemplateResultLionField
_hasFeedbackVisibleForprotectedUsed to translate `.hasFeedbackFor` and `.shouldShowFeedbackFor` to `.showsFeedbackFor`type: stringLionField
_helpTextTemplateprotectedTemplateResultLionField
_inputGroupAfterTemplateprotectedTemplateResultLionField
_inputGroupBeforeTemplateprotectedTemplateResultLionField
_inputGroupInputTemplateprotectedTemplateResultLionField
_inputGroupPrefixTemplateprotectedTemplateResult | nothingLionField
_inputGroupSuffixTemplateprotectedTemplateResult | nothingLionField
_inputGroupTemplateprotectedTemplateResultLionField
_isEmptyprotectedUsed for required validator.modelValue: anybooleanLionField
_isPrivateSlotprotectedslotName: stringbooleanLionField
_iStateOnLeaveprotectedSets touched value to true and reevaluates prefilled state. When false, on next interaction, user will start with a clean state.LionField
_iStateOnValueChangeprotectedSets dirty value and validates when already touched or invalidLionField
_labelTemplateprotectedTemplateResultLionField
_onBeforeRepropagateChildrenValuesprotectedHook for Subclassers to add logic before repropagationev: CustomEventLionField
_onChangeprotectedDispatches custom bubble eventev: Event=LionField
_onDirtyChangedprotectedDispatches event on touched state changeLionField
_onLabelClickprotectedLionField
_onModelValueChangedprotectedResponds to modelValue changes in the synchronous cycle (most subclassers should listen to the asynchronous cycle ('modelValue' in the .updated lifecycle)){ modelValue }, old: { modelValue:unknown }, newV: { modelValue:unknown }LionField
_onTouchedChangedprotectedDispatches event on touched state changeLionField
_onUserInputChangedprotectedLionField
_onValidatorUpdatedprotectede: Event|CustomEventLionField
_preventDuplicateLabelClickprotectedThe native platform fires an event for both the click on the label, and also the redispatched click on the native input element. This results in two click events arriving at the host, but we only want one. This method prevents the duplicate click and ensures the correct isTrusted event with the correct event.target arrives at the host.ev: EventChoiceInputMixin
_prioritizeAndFilterFeedbackprotectedOrders all active validators in this.__validationResult. Can also filter out occurrences (based on interaction states){ validationResult }, opts: { validationResult: Validator[] }Validator[]LionField
_proxyInputEventprotectedThis can be called whenever the view value should be updated. Dependent on component type ("input" for <input> or "change" for <select>(mainly for IE)) a different event should be used as source for the "user-input-changed" event (which can be seen as an abstraction layer on top of other events (input, change, whatever))LionField
_reflectBackFormattedValueToUserprotectedSynchronization from `LionField.value` to `._inputNode.value` - flow [1] will always be reflected back - flow [2] will not be reflected back when this flow was triggered via `@user-input-changed` (this will happen later, when `formatOn` condition is met)LionField
_reflectBackOnprotectedEvery time .formattedValue is attempted to sync to the view value (on change/blur and on modelValue change), this condition is checked. When enhancing it, it's recommended to call via `return this._myExtraCondition && super._reflectBackOn()`booleanLionField
_repropagationConditionprotectedBased on provided target, this condition determines whether received model-value-changed event should be repropagatedtarget: FormControlHostLionField
_setValueAndPreserveCaretprotectedRestores the cursor to its original position after updating the value.newValue: stringNativeTextFieldMixin
_showFeedbackConditionForprotectedDefault feedbackCondition condition, used by Subclassers, that will be used when `feedbackCondition()` is not overridden by Application Developer. Show the validity feedback when returning true, don't show when falsetype: string, meta: InteractionStatesLionField
_syncNameToParentFormGroupprotectedOverride this in case of extending ChoiceInputMixin and requiring to sync differently with parent form group name Right now it checks tag name match where the parent form group tagname should include the child field tagname ('checkbox' is included in 'checkbox-group')ChoiceInputMixin
_syncValueUpwardsprotectedSynchronization from `._inputNode.value` to `LionField` (flow [2]) Downwards syncing should only happen for `LionField`.value changes from 'above'. This triggers _onModelValueChanged and connects user input to the parsing/formatting/serializing loop.LionField
_toggleCheckedprotectedev: EventChoiceInputMixin
_triggerInitialModelValueChangedEventprotectedLionField
_updateFeedbackComponentprotectedResponsible for retrieving messages from Validators and (delegation of) rendering them. For `._feedbackNode` (extension of LionValidationFeedback): - retrieve messages from highest prio Validators - provide the result to custom feedback node and let the custom node decide on their renderings In both cases: - we compute the 'show' flag (like 'hasErrorVisible') for all types - we set the customValidity message of the highest prio Validator - we set aria-invalid="true" in case hasErrorVisible is trueLionField
_updateShouldShowFeedbackForprotectedLionField

Events

NameTypeDescriptionInherited From
model-value-changedCustomEventLionField
user-input-changedEventLionField
focusEventLionField
blurEventLionField
focusinEventLionField
focusoutEventLionField
form-element-name-changedCustomEventLionField
form-element-registerCustomEventLionField
touched-changedEventLionField
dirty-changedEventLionField
showsFeedbackForChangedEventLionField
EventLionField
shouldShowFeedbackForChangedEventLionField
validate-performedEventprivate event that should be listened to by LionFieldSetLionField

Attributes

NameFieldInherited From
checkedcheckedChoiceInputMixin
disableddisabledLionField
modelValuemodelValueChoiceInputMixin
choiceValuechoiceValueChoiceInputMixin
autocompleteautocompleteNativeTextFieldMixin
focusedfocusedLionField
focused-visiblefocusedVisibleLionField
autofocusautofocusLionField
readonlyreadOnlyLionField
labellabelLionField
label-sr-onlylabelSrOnlyLionField
help-texthelpTextLionField
typetypeLionInput
placeholderplaceholderLionInput
namenameLionField
allow-cross-root-registrationallowCrossRootRegistrationLionField
touchedtouchedLionField
dirtydirtyLionField
filledfilledLionField
shows-feedback-forshowsFeedbackForLionField
is-pendingisPendingLionField

class: LionRadioGroup, lion-radio-group

Fields

NamePrivacyTypeDefaultDescriptionInherited From
defaultValidatorspublicValidator[][]Used by Subclassers to add default Validators to a particular FormControl. A date input for instance, always needs the isDate validator.ValidateMixin
dirtypublicbooleanfalseTrue when user has changed the value of the field.FormGroupMixin
disabledpublicbooleanfalseDisables all formElements in groupDisabledMixin
donepublicbooleanfalseFormRegistrarMixin
fieldNamepublicstringWill be used in validation messages to refer to the current fieldFormControlMixin
filledpublicbooleanfalseTrue when the modelValue is non-empty (see _isEmpty in FormControlMixin)InteractionStateMixin
focusedpublicbooleanfalseTrue when any of the children is focused.FormGroupMixin
formattedValuepublicObject keyed by formElements names, containing formElements' formattedValuesFormGroupMixin
formElementspublicFormControlsCollectionnew FormControlsCollection()Closely mimics the natively supported HTMLFormControlsCollection. It can be accessed both like an array and an object (based on control/element names).FormRegistrarMixin
hasFeedbackForpublicValidationType[][]As soon as validation happens (after modelValue/validators/validator param change), this array is updated with the active ValidationTypes ('error'|'warning'|'success'|'info' etc.). Notice the difference with `.showsFeedbackFor`, which filters `.hasFeedbackFor` based on `.feedbackCondition()`. For styling purposes, will be reflected to [has-feedback-for="error warning"]. This can be useful for subtle visual feedback on keyup, like a red/green border around an input.ValidateMixin
helpTextpublicstring''The helpt text for the input node. When no value is defined, textContent of [slot=help-text] will be usedFormControlMixin
initCompletepublicPromise<any>new Promise((resolve, reject) => { this.__resolveInitComplete = resolve; this.__rejectInitComplete = reject; })initComplete resolves after all pending initialization logic (for instance `<form-group .serializedValue=$>`) is executedFormRegistrarMixin
isPendingpublicbooleanfalseFlag indicating whether async validation is pending. Creates attribute [is-pending] as a styling hookValidateMixin
labelpublicstring''The label text for the input node. When no value is defined, textContent of [slot=label] will be usedFormControlMixin
labelSrOnlypublicbooleanfalseThe label will only be visible for srceen readers when trueFormControlMixin
modelValuepublicObject keyed by formElements names, containing formElements' modelValuesFormControlMixin
multipleChoicepublicbooleanfalseWhen false (default), modelValue and serializedValue will reflect the currently selected choice (usually a string). When true, modelValue will and serializedValue will be an array of strings.ChoiceGroupMixin
operationModepublicOperationModeTypes of input interaction of the FormControl (for instance 'enter'|'select'|'upload')ValidateMixin
prefilledpublicbooleanfalseTrue when user has left non-empty field or input is prefilled. The name must be seen from the point of view of the input field: once the user enters the input field, the value is non-empty.FormGroupMixin
readOnlypublicbooleanfalseA Boolean attribute which, if present, indicates that the user should not be able to edit the value of the input. The difference between disabled and readonly is that read-only controls can still function, whereas disabled controls generally do not function as controls until they are enabled. (From: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)FormControlMixin
registrationCompletepublicPromise<any> & {done?:boolean}new Promise((resolve, reject) => { this.__resolveRegistrationComplete = resolve; this.__rejectRegistrationComplete = reject; })registrationComplete waits for all children formElements to have registeredFormRegistrarMixin
serializedValuepublicObject keyed by formElements names, containing formElements' serializedValuesFormGroupMixin
showsFeedbackForpublicValidationType[][]Based on outcome of feedbackCondition, this array decides what ValidationTypes should be shown in validationFeedback, based on meta data like interaction states. For styling purposes, it reflects it `[shows-feedback-for="error warning"]`ValidateMixin
submittedpublicbooleanfalseTrue when parent form is submittedFormGroupMixin
touchedpublicbooleanfalseTrue when user has focused and left(blurred) the field.FormGroupMixin
validationStatespublicValidationStates{}The outcome of a validation 'round'. Keyed by ValidationType and Validator nameValidateMixin
validatorspublicValidator[][]Used by Application Developers to add Validators to a FormControl.ValidateMixin
valuepublicstring''FormGroupMixin
_allValidatorsprotectedValidator[]Combination of validators provided by Application Developer and the default validatorsValidateMixin
_ariaDescribedNodespublicHTMLElement[][]Contains all elements that should end up in aria-describedby of `._inputNode`FormControlMixin
_ariaLabelledNodespublicHTMLElement[][]Contains all elements that should end up in aria-labelledby of `._inputNode`FormControlMixin
_feedbackConditionMetaprotectedAllows Subclassers to add meta info for feedbackConditionValidateMixin
_feedbackNodeprotectedElement where validation feedback will be rendered toFormControlMixin
_helpTextNodeprotectedElement where help text will be rendered toFormControlMixin
_initialModelValueprotectedGathers initial model values of all children. Used when resetGroup() is called.FormGroupMixin
_inputIdprotectedstringUnique id that can be used in all light domFormControlMixin
_inputNodeprotectedThe host element with role group (or radio-group or form) containing necessary aria attributesFormControlMixin
_isFormOrFieldsetprotectedbooleanfalseFlag that determines how ".formElements" should behave. For a regular fieldset (see LionFieldset) we expect ".formElements" to be accessible as an object. In case of a radio-group, a checkbox-group or a select/listbox, it should act like an array (see ChoiceGroupMixin). Usually, when false, we deal with a choice-group (radio-group, checkbox-group, (multi)select)FormRegistrarMixin
_isRepropagationEndpointpublicbooleanfalseBy default, a field with _repropagationRole 'choice-group' will act as an 'endpoint'. This means it will be considered as an individual field: for a select, individual options will not be part of the formPath. They will. Similarly, components that (a11y wise) need to be fieldsets, but 'interaction wise' (from Application Developer perspective) need to be more like fields (think of an amount-input with a currency select box next to it), can set this to true to hide private internals in the formPath.FormControlMixin
_labelNodeprotectedElement where label will be rendered toFormControlMixin
_leaveEventprotectedstring'blur'The event that triggers the touched stateInteractionStateMixin
_repropagationRolepublic'child'|'choice-group'|'fieldset''choice-group'Based on the role, details of handling model-value-changed repropagation differ.FormControlMixin
_requestedToBeDisabledprotectedbooleanfalseDisabledMixin
_valueChangedEventprotectedstring'model-value-changed'The event that triggers the dirty stateInteractionStateMixin
_visibleMessagesAmountprotectednumber1The amount of feedback messages that will visible in LionValidationFeedbackValidateMixin

Methods

NamePrivacyDescriptionParametersReturnInherited From
addFormElementpublicchild: FormControl, indexToInsertAt: numberFormRegistrarMixin
addToAriaDescribedBypublicAllows to add element references to aria-describedby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}FormControlMixin
addToAriaLabelledBypublicAllows to add extra element references to aria-labelledby attribute.element: HTMLElement, { idPrefix = '', reorder = true }, customConfig: {idPrefix?:string; reorder?: boolean}FormControlMixin
clearpublicChoiceGroupMixin
clearGrouppublicClears all values and resets all interaction states of all FormControls in group,FormGroupMixin
clickpublicDisabledMixin
feedbackConditionpublicAllows the Application Developer to specify when a feedback message should be showntype: string, meta: object, currentCondition: ((type: string, meta: object) => boolean)booleanValidateMixin
initInteractionStatepublicEvaluations performed on connectedCallback. This method is public, so it can be called at a later moment (when we need to wait for registering children for instance) as well. Since this method will be called twice in last mentioned scenario, it must stay idempotent.InteractionStateMixin
isRegisteredFormElementpublicel: ElementWithParentFormGroupFormRegistrarMixin
makeRequestToBeDisabledpublicDisabledMixin
removeFormElementpublicchild: FormControlHostFormRegistrarMixin
removeFromAriaDescribedBypublicAllows to remove element references from aria-describedby attribute.element: HTMLElementFormControlMixin
removeFromAriaLabelledBypublicAllows to remove element references from aria-labelledby attribute.element: HTMLElementFormControlMixin
resetGrouppublicResets to initial/prefilled values and interaction states of all FormControls in group,FormGroupMixin
resetInteractionStatepublicResets touched and dirty, and recomputes prefilledFormGroupMixin
retractRequestToBeDisabledpublicDisabledMixin
submitGrouppublicHandles interaction state 'submitted'. This allows children to enable visibility of validation feedbackFormGroupMixin
updateSyncpublicname: string, oldValue: ?ValidateMixin
validatepublicTriggered by: - modelValue change - change in the 'validators' array - change in the config of an individual Validator Three situations are handled: - a1) the FormControl is empty: further execution is halted. When the Required Validator (being mutually exclusive to the other Validators) is applied, it will end up in the validation result (as the only Validator, since further execution was halted). - a2) there are synchronous Validators: this is the most common flow. When modelValue hasn't changed since last async results were generated, 'sync results' are merged with the 'async results'. - a3) there are asynchronous Validators: for instance when server side evaluation is needed. Executions are scheduled and awaited and the 'async results' are merged with the 'sync results'. - b) there are MetaValidators. After steps a1, a2, or a3 are finished, the holistic MetaValidators (evaluating the total result of the 'regular' (a1, a2 and a3) validators) will be run... Situations a2 and a3 are not mutually exclusive and can be triggered within one `validate()` call. Situation b will occur after every call.{ clearCurrentResult = false }, opts: { clearCurrentResult?: boolean }ValidateMixin
_anyFormElementHasprotectedReturns true when one of the formElements has requestedproperty: stringFormGroupMixin
_anyFormElementHasFeedbackForprotectedstate: stringFormGroupMixin
_checkForOutsideClickprotectedevent: EventFormGroupMixin
_checkSingleChoiceElementsprotectedev: CustomEvent & {target:FormControl}ChoiceGroupMixin
_completeRegistrationprotectedResolves the registrationComplete promise. Subclassers can delay if neededFormRegistrarMixin
_dispatchInitialModelValueChangedEventprotectedFormControlMixin
_enhanceLightDomA11yprotectedFormControlMixin
_enhanceLightDomA11yForAdditionalSlotsprotectedEnhances additional slots(prefix, suffix, before, after) defined by developer. When boolean attribute data-label or data-description is found, the slot element will be connected to the input via aria-labelledby or aria-describedbyadditionalSlots: string[]FormControlMixin
_enhanceLightDomClassesprotectedFormControlMixin
_everyFormElementHasprotectedReturns true when all of the formElements have requested propertyproperty: stringFormGroupMixin
_feedbackTemplateprotectedTemplateResultFormControlMixin
_getAriaDescriptionElementsprotectedThis function exposes descripion elements that a FormGroup should expose to its children. See FormGroupMixin.__getAllDescriptionElementsInParentChain()Array.<HTMLElement>FormControlMixin
_getCheckedElementsprotectedChoiceGroupMixin
_getFromAllFormElementsprotectedImplicit :(property: string, filterFn: (el: FormControl, property?: string) => boolean{[name:string]: any}FormGroupMixin
_getFromAllFormElementsFilterprotectedA filter function which will exclude a form field when returning false By default, exclude form fields which are disabled The type is be passed as well for more fine grained control, e.g. distinguish the filter when fetching modelValue versus serializedValueel: FormControl, type: stringbooleanFormGroupMixin
_groupOneTemplateprotectedTemplateResultFormControlMixin
_groupTwoTemplateprotectedTemplateResultFormControlMixin
_hasFeedbackVisibleForprotectedUsed to translate `.hasFeedbackFor` and `.shouldShowFeedbackFor` to `.showsFeedbackFor`type: stringValidateMixin
_helpTextTemplateprotectedTemplateResultFormControlMixin
_inputGroupAfterTemplateprotectedTemplateResultFormControlMixin
_inputGroupBeforeTemplateprotectedTemplateResultFormControlMixin
_inputGroupInputTemplateprotectedTemplateResultFormControlMixin
_inputGroupPrefixTemplateprotectedTemplateResult | nothingFormControlMixin
_inputGroupSuffixTemplateprotectedTemplateResult | nothingFormControlMixin
_inputGroupTemplateprotectedTemplateResultFormControlMixin
_isEmptyprotectedUsed for Required validation and computation of interaction statesmodelValue: anybooleanFormControlMixin
_iStateOnLeaveprotectedSets touched value to true and reevaluates prefilled state. When false, on next interaction, user will start with a clean state.InteractionStateMixin
_iStateOnValueChangeprotectedSets dirty value and validates when already touched or invalidInteractionStateMixin
_labelTemplateprotectedTemplateResultFormControlMixin
_onBeforeRepropagateChildrenValuesprotectedHook for Subclassers to add logic before repropagationev: CustomEventFormControlMixin
_onDirtyChangedprotectedDispatches event on touched state changeInteractionStateMixin
_onFocusOutprotectedev: EventFormGroupMixin
_onLabelClickprotectedFormControlMixin
_onRequestToAddFormElementprotectedHook for Subclassers to perform logic before an element is addedev: CustomEventFormRegistrarMixin
_onRequestToChangeFormElementNameprotectedev: CustomEventFormRegistrarMixin
_onRequestToRemoveFormElementprotectedev: CustomEventFormRegistrarMixin
_onTouchedChangedprotectedDispatches event on touched state changeInteractionStateMixin
_onValidatorUpdatedprotectede: Event|CustomEventValidateMixin
_prioritizeAndFilterFeedbackprotectedOrders all active validators in this.__validationResult. Can also filter out occurrences (based on interaction states){ validationResult }, opts: { validationResult: Validator[] }Validator[]ValidateMixin
_repropagationConditionprotectedBased on provided target, this condition determines whether received model-value-changed event should be repropagatedtarget: FormControlHost & ChoiceInputHostFormControlMixin
_setCheckedElementsprotectedvalue: string | any[], check: FunctionChoiceGroupMixin
_setValueForAllFormElementsprotectedSets the same value for requested property in all formElementsproperty: string | number, value: anyFormGroupMixin
_setValueMapForAllFormElementsprotectedAllows to set formElements values via a keyed object structureproperty: string, values: { [x: string]: any; }FormGroupMixin
_showFeedbackConditionForprotectedDefault feedbackCondition condition, used by Subclassers, that will be used when `feedbackCondition()` is not overridden by Application Developer. Show the validity feedback when returning true, don't show when falsetype: string, meta: objectValidateMixin
_syncDirtyprotectedFormGroupMixin
_syncFocusedprotectedFormGroupMixin
_throwWhenInvalidChildModelValueprotectedchild: FormControlChoiceGroupMixin
_triggerInitialModelValueChangedEventprotectedFormControlMixin
_updateFeedbackComponentprotectedResponsible for retrieving messages from Validators and (delegation of) rendering them. For `._feedbackNode` (extension of LionValidationFeedback): - retrieve messages from highest prio Validators - provide the result to custom feedback node and let the custom node decide on their renderings In both cases: - we compute the 'show' flag (like 'hasErrorVisible') for all types - we set the customValidity message of the highest prio Validator - we set aria-invalid="true" in case hasErrorVisible is trueValidateMixin
_updateShouldShowFeedbackForprotectedValidateMixin

Events

NameTypeDescriptionInherited From
showsFeedbackForChangedEventValidateMixin
EventValidateMixin
shouldShowFeedbackForChangedEventValidateMixin
validate-performedEventprivate event that should be listened to by LionFieldSetValidateMixin
touched-changedEventInteractionStateMixin
dirty-changedEventInteractionStateMixin
form-element-name-changedCustomEventFormControlMixin
model-value-changedCustomEventFormControlMixin

Attributes

NameFieldInherited From
multiple-choicemultipleChoiceChoiceGroupMixin
_isFormOrFieldset_isFormOrFieldsetFormRegistrarMixin
shows-feedback-forshowsFeedbackForValidateMixin
is-pendingisPendingValidateMixin
touchedtouchedFormGroupMixin
dirtydirtyFormGroupMixin
filledfilledInteractionStateMixin
submittedsubmittedFormGroupMixin
focusedfocusedFormGroupMixin
prefilledprefilledFormGroupMixin
readonlyreadOnlyFormControlMixin
labellabelFormControlMixin
label-sr-onlylabelSrOnlyFormControlMixin
help-texthelpTextFormControlMixin
disableddisabledDisabledMixin