Usage
Signature:
interface CRadiosetElement<V extends string | number,D extends oj-c.Radioset.RadiosetDataItem>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CRadiosetElement } from "oj-c/radioset";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/radioset";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Attributes
-
column-span :number
-
Specifies how many columns this component should span. This only takes effect when this component is a child of a form layout that has direction 'row'.
- Default Value:
1
Names
Item Name Property columnSpanProperty change event columnSpanChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-column-span-changed -
container-readonly :boolean
-
Specifies whether an ancestor container, like oj-c-form-layout, is readonly. This affects whether a readonly component renders in full or mixed readonly mode.
Names
Item Name Property containerReadonlyProperty change event containerReadonlyChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-container-readonly-changed -
direction :"row"|"column"
-
Layout direction of the radioset radio elements.
- Default Value:
"column"
Names
Item Name Property directionProperty change event directionChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-direction-changed -
disabled :boolean
-
Specifies whether the component is disabled or not. The default is false.
When the
disabledproperty changes due to programmatic intervention, the component may clear messages and run validation in some cases.
- when a required component is initialized as disabled
value="{{currentValue}}" required disabled, deferred validation is skipped. - when a disabled component is enabled,
- if the component is invalid and showing messages then all component messages are cleared,
and full validation will be run using the display value.
- if there are validation errors, they are shown.
- if no errors result from the validation, the
valueproperty is updated. Page authors can listen to thevalueChangedevent to clear custom errors.
- if the component is valid and has no errors then deferred validation is run.
- if there is a deferred validation error, then the valid property is updated.
- if the component is invalid and has deferred errors then component messages are cleared and
deferred validation is re-run.
- if there is a deferred validation error, then the valid property is updated.
- if the component is invalid and showing messages then all component messages are cleared,
and full validation will be run using the display value.
- when and enabled component is disabled then no validation is run and the component appears disabled.
- Default Value:
false
Names
Item Name Property disabledProperty change event disabledChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-disabled-changed - when a required component is initialized as disabled
-
display-options :oj-c.Radioset.DisplayOptions
-
Display options for auxiliary content that describes whether or not the auxiliary content should be displayed.
Names
Item Name Property displayOptionsProperty change event displayOptionsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-options-changed -
help :oj-c.Radioset.Help
-
Form component help information.
Names
Item Name Property helpProperty change event helpChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-help-changed -
help-hints :oj-c.Radioset.HelpHints
-
The helpHints object contains a definition property, sourceText property, and a source property.
Names
Item Name Property helpHintsProperty change event helpHintsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-help-hints-changed -
label-edge :"inside"|"none"|"start"|"top"
-
Specifies how the label of the component is positioned when the label-hint attribute is set on the component.
Supported Values:
Value Description insideThe label will be placed on top of the radioset, but is smaller than the 'top' option. noneThe radioset will not create a label, but instead will set the aria-label property on the radioset. startThe label will be placed before the start of the radioset. topThe label will be placed on top of the radioset. Names
Item Name Property labelEdgeProperty change event labelEdgeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label-edge-changed -
label-hint* :string
-
Represents a hint for rendering a label on the component. This is used in combination with the label-edge attribute to control how the label should be rendered.
Names
Item Name Property labelHintProperty change event labelHintChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label-hint*-changed -
label-start-width :(number|string)
-
The width of the label when labelEdge is 'start'.
This attribute accepts values of type
0 | `var(${string})` | `--${string}` | `${number}%` | `${number}x` | `calc(${string})` | `${number}${CssUnits}Names
Item Name Property labelStartWidthProperty change event labelStartWidthChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label-start-width-changed -
label-wrapping :"truncate"|"wrap"
-
A property that applications can use to specify how the radioset label should render when there is not enough available space.
Supported Values:
Value Description truncateLabel will truncate if needed. wrapLabel will wrap if needed. Names
Item Name Property labelWrappingProperty change event labelWrappingChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label-wrapping-changed -
messages-custom :Array.<oj-c.Radioset.ComponentMessageItem>
-
List of messages an app would add to the component when it has business/custom validation errors that it wants the component to show. This allows the app to perform further validation before sending data to the server. When this option is set the message will be shown to the user right away. To clear the custom message, set
messagesCustomback to an empty array.
See the Validation and Messages section for details on when the component clears
messagesCustom; for example, when full validation is run.- Default Value:
[]
- Supports writeback:
true
Names
Item Name Property messagesCustomProperty change event messagesCustomChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-messages-custom-changed -
options* :Array<(oj-c.Radioset.RadiosetDataItem & { value: V; })>|DataProvider<V, D>
-
The data provided to the radioset that represents one or more radio items. Regardless of the type used for this attribute (whether it's a DataProvider implementation or an Array of data items) the value and label properties are required. In the DataProvider case, the key of the DataProvider will be used as the radio item value. See the custom element usage section for details on the type parameter definitions.
Names
Item Name Property optionsProperty change event optionsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-options*-changed -
readonly :boolean
-
Whether the component is readonly. The readonly property sets or returns whether an element is readonly, or not. A readonly element cannot be modified. However, a user can tab to it, highlight it, focus on it, and copy the text from it. If you want to prevent the user from interacting with the element, use the disabled property instead.
- Default Value:
false
Names
Item Name Property readonlyProperty change event readonlyChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-readonly-changed -
required :boolean
-
When this property is set to
falseit implies that a value is not required to be provided by the user. This is the default. When this property set totrueimplies that a value is required to be provided by the user.In the Redwood theme, by default, a Required text is rendered inline when no radio option is selected.
The Required error text is based on Redwood UX designs, and it is not recommended to be changed. To override the required error message, use the
required-message-detailattribute. The component's label text is passed in as a token {label} and can be used in the message detail.When required is set to true, an implicit required validator is created, i.e.,
new RequiredValidator(). The required validator is the only validator to run during initial render, and its error is not shown to the user at this time; this is called deferred validation. The required validator also runs during normal validation; this is when the errors are shown to the user. See the Validation and Messaging section for details.When the
requiredproperty changes due to programmatic intervention, the component may clear component messages and run validation, based on the current state it's in.
Running Validation when required property changes
- if component is valid when required is set to true, then it runs deferred validation on the value property. If the field is empty, the valid state is invalidHidden. No errors are shown to the user.
- if component is valid when required is set from true to false, then no validation is run.
- if component is invalid and has deferred messages (invalidHidden) when required is set to false, then component messages are cleared (messages-custom messages are not cleared) but no deferred validation is run because required is false.
- if component is invalid and currently showing invalid messages (invalidShown) when required is changed
to either true or false, then
component messages are cleared and normal validation is run using the current display value.
- if there are validation errors, then
valueproperty is not updated and the error is shown. - if no errors result from the validation, the
valueproperty is updated; page author can listen to thevalueChangedevent on the component to clear custom errors.
- if there are validation errors, then
Clearing Messages when required property changes
- Only messages created by the component, like validation messages, are cleared when the required property changes.
messagesCustomproperty is not cleared.
- Default Value:
false
Names
Item Name Property requiredProperty change event requiredChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-required-changed -
required-message-detail :string
-
The component-specific message detail when the required validation fails. If the component needs a required validation error message that is different from the default, set this property. It should be a translated string.
Names
Item Name Property requiredMessageDetailProperty change event requiredMessageDetailChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-required-message-detail-changed -
user-assistance-density :"reflow"|"efficient"|"compact"
-
Specifies the density of the form component's user assistance presentation. It can be shown inline with reserved rows to prevent reflow if a user assistance text shows up, inline without reserved rows that would reflow if a user assistance text shows up, or it can be shown compactly in a popup instead.
- Default Value:
"reflow"
Supported Values:
Value Description compactMessages, help, hints, and required will not be shown inline; they will show in a mode that keeps the screen more compact, like a popup for the messages, and a required icon to indicate Required. efficientMessages, help, hints, and required are all shown inline under the field with reserved space. reflowMessages, help, hints, and required are all shown inline under the field with no reserved space. Names
Item Name Property userAssistanceDensityProperty change event userAssistanceDensityChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-user-assistance-density-changed -
(readonly) valid :"valid"|"pending"|"invalidHidden"|"invalidShown"
-
The current valid state of the component. It is evaluated on initial render. It is re-evaluated
- when messagesCustom is updated, since messagesCustom can be added by the app developer any time.
- when showMessages() is called. Since showMessages() moves the hidden messages into messages shown, if the valid state was "invalidHidden" then it would become "invalidShown".
- when the required property has changed. If a component is empty and has required set, the valid state may be "invalidHidden" (if no invalid messages are being shown as well). If required property is removed, the valid state would change to "valid".
Note: New valid states may be added to the list of valid values in future releases. Any new values will start with "invalid" if it is an invalid state, "pending" if it is pending state, and "valid" if it is a valid state.
- Supports writeback:
true
Supported Values:
Value Description invalidHiddenThe component has invalid messages hidden and no invalid messages showing. An invalid message is one with severity 'error'. invalidShownThe component has invalid messages showing. An invalid message is one with severity 'error'. pendingThe component is waiting for the validation state to be determined. The 'pending' state is set at the start of the convert/validate process. validThe component is valid Names
Item Name Property validProperty change event validChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-valid-changed -
value :(V|null)
-
The value of the component.
When
valueproperty changes due to programmatic intervention, the component always clears all messages includingmessagesCustom, runs deferred validation, and always refreshes UI display value.Running Validation
- component always runs deferred validation; the
validproperty is updated with the result.
- Default Value:
null
- Supports writeback:
true
Names
Item Name Property valueProperty change event valueChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-value-changed - component always runs deferred validation; the
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description propertyThe property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
reset : {void}
-
Resets the component by clearing all messages.
Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesAn object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description propertyThe property name to set. Supports dot notation for subproperty access. valueThe new value to set the property to. Returns:
- Type
- void
-
showMessages : {void}
-
Takes all deferred messages and shows them. It then updates the valid property; e.g., if the valid state was "invalidHidden" before showMessages(), the valid state will become "invalidShown" after showMessages().
If there were no deferred messages this method simply returns.Returns:
- Type
- void
-
validate : {Promise}
-
Validates the component's display value using all validators registered on the component and updates the
valueoption by performing the following steps.- All messages are cleared, including custom messages added by the app.
- The implicit required validator is run if the component is marked required.
- At the end of validation if there are errors, the messages are shown. If there were no errors,
then the
valueproperty is updated.
Returns:
Promise resolves to "valid" if the component passed all validations, or "invalid" if there were validation errors.
- Type
- Promise
Type Definitions
-
ComponentMessageItem
-
Properties:
Name Type Argument detailstring <optional>
severity"error" | "confirmation" | "info" | "warning" <optional>
summarystring <optional>
-
DisplayOptions
-
Display options for auxiliary content that determines whether or not it should be displayed.
Properties:
Name Type Argument Default Description messages"none" | "display" <optional>
"display" Display options for auxiliary message text. -
Help
-
Form component help information.
Properties:
Name Type Argument Description instructionstring <optional>
A type of user assistance text. User assistance text is used to provide guidance to help the user understand what data to enter or select. -
HelpHints
-
The helpHints object contains a definition property and a source property.
Properties:
Name Type Argument Description definitionstring <optional>
A type of user assistance text. User assistance text is used to provide guidance to help the user understand what data to enter or select. help-hints could come from a help system. sourcestring <optional>
Help source URL associated with the component. sourceTextstring <optional>
Custom text to be used for the source link. -
RadiosetDataItem
-
The data item object that represents a radio item in the rendered radioset. The label property is required and provides the text for the radio item.
Properties:
Name Type Argument Description assistiveTextstring <optional>
Optional value to provide guidance to the user about the radio item this applies to. helpSourceLinkstring <optional>
Optional link to aid the user in the radio item this applies to. helpSourceTextstring <optional>
Optional custom text to be rendered for the helpSourceLink.labelstring The value of this required property will provide the text for the radio button's label.