Usage
Signature:
interface CRichCheckboxsetElement<V extends string | number>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CRichCheckboxsetElement } from "oj-c/rich-checkboxset";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/rich-checkboxset";
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 columnSpan
Property change event columnSpanChanged
Property 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 containerReadonly
Property change event containerReadonlyChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-container-readonly-changed
-
disabled :boolean
-
Whether the component is disabled. The default is false.
When the
disabled
property 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 component is invalid and showing messages then all component messages are cleared,
and full validation run using the display value.
- if there are validation errors, they are shown.
- if no errors result from the validation, the
value
property is updated. Page authors can listen to thevalueChanged
event to clear custom errors.
- if 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 component is invalid and deferred errors then component messages are cleared and
deferred validation re-run.
- if there is a deferred validation error, then the valid property is updated.
- if component is invalid and showing messages then all component messages are cleared,
and full validation run using the display value.
- when enabled component is disabled then no validation is run and the component appears disabled.
- Default Value:
false
Names
Item Name Property disabled
Property change event disabledChanged
Property 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.RichCheckboxset.DisplayOptionsProps
-
Display options for auxiliary content that describes whether or not it should be displayed.
Names
Item Name Property displayOptions
Property change event displayOptionsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-options-changed
-
help :oj-c.RichCheckboxset.Help
-
Form component help information.
Names
Item Name Property help
Property change event helpChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-help-changed
-
help-hints :oj-c.RichCheckboxset.HelpHints
-
The helpHints object contains a definition property, sourceText property, and a source property.
Names
Item Name Property helpHints
Property change event helpHintsChanged
Property 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 inside
The label will be placed on top of the rich checkboxset, but is smaller than 'top' option. none
The rich checkboxset will not create a label, but instead set the aria-label property on the rich checkboxset. start
The label will be placed before the start of the rich checkboxset. top
The label will be placed on top of the rich checkboxset. Names
Item Name Property labelEdge
Property change event labelEdgeChanged
Property 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 labelHint
Property change event labelHintChanged
Property 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 labelStartWidth
Property change event labelStartWidthChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label-start-width-changed
-
layout* :"sm"|"md"|"xl"
-
Specifies the layout of the cards and media.
Names
Item Name Property layout
Property change event layoutChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-layout*-changed
-
max-selected :number
-
Specifies the maximum number of selectable options. If defined, it must be greater than or equal to 2. If both "maxSelected" and "minSelected" are defined, "maxSelected" must be greater than or equal to "minSelected". To require an exact number of options to be selected, set "maxSelected" and "minSelected" to the same value. To require exactly one or a maximum of one item, use "RichRadioSet.
Names
Item Name Property maxSelected
Property change event maxSelectedChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-max-selected-changed
-
messages-custom :Array.<oj-c.RichCheckboxset.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 shows to the user right away. To clear the custom message, set
messagesCustom
back 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 messagesCustom
Property change event messagesCustomChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-messages-custom-changed
-
min-selected :number
-
Specifies the minimum number of selectable options. If defined, it must be greater than or equal to 2. If both "minSelected" and "maxSelected" are defined, "minSelected" must be less than or equal to "maxSelected". To require an exact number of options to be selected, set "minSelected" and "maxSelected" to the same value. To require at least one item to be selected, use "isRequired." To require exactly one item to be selected, use "RichRadioSet." If not required, a value of null will validate to "valid" even if "minSelected" is set.
Names
Item Name Property minSelected
Property change event minSelectedChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-min-selected-changed
-
options* :Array<oj-c.RichCheckboxset.ItemDataType<V> & oj-c.RichCheckboxset.NoMediaType|oj-c.RichCheckboxset.ItemDataType<V> & oj-c.RichCheckboxset.ThumbnailType|oj-c.RichCheckboxset.ItemDataType<V> & oj-c.RichCheckboxset.IconType|oj-c.RichCheckboxset.ItemDataType<V> & oj-c.RichCheckboxset.AvatarType>
-
An array of data items that returns the option items for the Rich Checkboxset.
Names
Item Name Property options
Property change event optionsChanged
Property 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.
If the property value is not set either directly on the component or inherited from a parent form layout, then the property is treated as if its value were false.
Names
Item Name Property readonly
Property change event readonlyChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-readonly-changed
-
required :boolean
-
This property set to
false
implies that a value is not required to be provided by the user. This is the default. This property set totrue
implies that a value is required to be provided by the user.In the Redwood theme, by default, a Required text is rendered inline when the field is empty.
The Required error text is based on Redwood UX designs, and it is not recommended that it be changed. To override the required error message, use the
required-message-detail
attribute. 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
required
property 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
value
property is not updated and the error is shown. - if no errors result from the validation, the
value
property is updated; page author can listen to thevalueChanged
event 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.
messagesCustom
property is not cleared.
- Default Value:
false
Names
Item Name Property required
Property change event requiredChanged
Property 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 requiredMessageDetail
Property change event requiredMessageDetailChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-required-message-detail-changed
-
selection-exact-message-detail :(p: oj-c.RichCheckboxset.ExactMessageDetailParameters) => string
-
A callback function that returns a component-specific message detail when the exact selection validation fails when a user's input is not the exact amount. If the component needs an exact selection error message that is different from the default, set this property. The function should return a translated string.
Usage:
selectionExactMessageDetail = (p: {exact: number }) => `Select {exact} values.`
selectionExactMessageDetail = () => `Select exactly five values.`Names
Item Name Property selectionExactMessageDetail
Property change event selectionExactMessageDetailChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-exact-message-detail-changed
-
selection-overflow-message-detail :(p: oj-c.RichCheckboxset.OverflowMessageDetailParameters) => string
-
A callback function that returns a component-specific message detail when the rich checkboxset validation fails when a user's input is greater than the max. If the component needs an overflow selection error message that is different from the default, set this property. The function should return a translated string.
Usage:
selectionOverflowMessageDetail = (p: {max: number }) => `You’ve reached the {max}-selection limit.`
selectionOverflowMessageDetail = () => `You’ve reached the limit.`Names
Item Name Property selectionOverflowMessageDetail
Property change event selectionOverflowMessageDetailChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-overflow-message-detail-changed
-
selection-range-message-detail :(p: oj-c.RichCheckboxset.RangeMessageDetailParameters) => string
-
A callback function that returns a component-specific message detail when the range selection validation fails when a user's input is not within the range amount. If the component needs a range selection error message that is different from the default, set this property. The function should return a translated string.
Usage:
selectionRangeMessageDetail = (p: {min: number, max: number }) => `Select {min} to {max} values.`
selectionRangeMessageDetail = () => `Select between two to three values.`Names
Item Name Property selectionRangeMessageDetail
Property change event selectionRangeMessageDetailChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-range-message-detail-changed
-
selection-underflow-message-detail :(p: oj-c.RichCheckboxset.UnderflowMessageDetailParameters) => string
-
A callback function that returns a component-specific message detail when the underflow selection validation fails when a user's input is less than the min. If the component needs an underflow selection error message that is different from the default, set this property. The function should return a translated string.
Usage:
selectionUnderflowMessageDetail = (p: {min: number }) => `Select at least {min} values.`
selectionUnderflowMessageDetail = () => `Select a minimum of three values.`Names
Item Name Property selectionUnderflowMessageDetail
Property change event selectionUnderflowMessageDetailChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-underflow-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.
If the property value is not set either directly on the component or inherited from a parent form layout, then the property is treated as if its value were "reflow".
Supported Values:
Value Description compact
Help and hints are shown above the field. Messages and required are shown inline under the field with reserved space. efficient
Help and hints are shown above the field. Messages and required are shown inline under the field with reserved space. reflow
Help and hints are shown above the field. Messages and required are shown inline under the field with no reserved space. Names
Item Name Property userAssistanceDensity
Property change event userAssistanceDensityChanged
Property 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 invalidHidden
The component has invalid messages hidden and no invalid messages showing. An invalid message is one with severity 'error'. invalidShown
The component has invalid messages showing. An invalid message is one with severity 'error'. pending
The component is waiting for the validation state to be determined. The 'pending' state is set at the start of the convert/validate process. valid
The component is valid Names
Item Name Property valid
Property change event validChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-valid-changed
-
value :Array<V>|null
-
The value of the component.
When
value
property changes due to programmatic intervention, the component always clears all messages includingmessagesCustom
, runs deferred validation, and always refreshes UI display value.When the rich checkboxset is cleared and the value is committed, the
value
property is set tonull
.Running Validation
- component always runs deferred validation; the
valid
property is updated with the result.
- Default Value:
null
- Supports writeback:
true
Names
Item Name Property value
Property change event valueChanged
Property 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 property
The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
reset : {void}
-
Resets the component by clearing all messages as well as the
messagesCustom
attribute, and also resets the component instance'svalue
to its default. Any user entered value will be erased.Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description properties
An 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 property
The property name to set. Supports dot notation for subproperty access. value
The 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. While actively editing the component selections, the valid state may be "invalidHidden" until showMessages().
Returns:
- Type
- void
-
validate : {Promise}
-
If enabled, validates the component's display value (or null if display value is empty) and updates the value option by performing the following steps.
- All messages are cleared, including custom messages added by the app.
- At the end of validation if there are errors, the messages are shown. If there were no errors, then the value option is updated.
While actively editing the component selections, the valid state may be "invalidHidden" until validate() is called. If the component is readonly or disabled, returns a Promise that resolves to 'valid' without doing any validation.
Returns:
The Promise resolves to "valid" if the component is disabled or readonly. The Promise resolves to "invalid" if there were errors.
- Type
- Promise
Type Definitions
-
AvatarType
-
Properties:
Name Type Argument Description avatar
oj-c.RichCheckboxset.RichSelectionAvatar <optional>
iconClass
never <optional>
mediaAccessibleLabel
string <optional>
This will apply aria-label to Avatar. If it's not provided the media would be hidden from screen readers. thumbnailSrc
never <optional>
-
ComponentMessageItem
-
A type for a single component message
Properties:
Name Type Argument detail
string <optional>
severity
"error" | "confirmation" | "info" | "warning" <optional>
summary
string <optional>
-
DisplayOptionsProps
-
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. -
ExactMessageDetailParameters
-
Parameters that are passed into the selectionExactMessageDetail callback function.
Properties:
Name Type Description exact
number The exact allowed number of selections. -
Help
-
Form component help information.
Properties:
Name Type Argument Description instruction
string <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 definition
string <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. source
string <optional>
Help source URL associated with the component. sourceText
string <optional>
Custom text to be used for the source link. -
IconType
-
Properties:
Name Type Argument avatar
never <optional>
iconClass
string <optional>
mediaAccessibleLabel
never <optional>
thumbnailSrc
never <optional>
-
ItemDataType<V>
-
Properties:
Name Type Argument Description label
string Considered as label and accessible text for the component. secondaryText
string <optional>
Provides concise detail information about the item. value
V Value of the RichSelectionItem. -
NoMediaType
-
Properties:
Name Type Argument avatar
never <optional>
iconClass
never <optional>
mediaAccessibleLabel
never <optional>
thumbnailSrc
never <optional>
-
OverflowMessageDetailParameters
-
Parameters that are passed into the selectionOverflowMessageDetail callback function.
Properties:
Name Type Description max
number The maximum allowed number of selections. -
RangeMessageDetailParameters
-
Parameters that are passed into the selectionRangeMessageDetail callback function.
Properties:
Name Type Description max
number The maximum allowed number of selections. min
number The minimum allowed number of selections. -
RichSelectionAvatar
-
Partial Avatar Props type utilized for the media.
Properties:
Name Type Argument background
"blue" | "gray" | "green" | "orange" | "pink" | "purple" | "teal" | "neutral" | "slate" | "lilac" <optional>
initials
string <optional>
shape
"square" | "circle" <optional>
src
string <optional>
-
ThumbnailType
-
Properties:
Name Type Argument Description avatar
never <optional>
iconClass
never <optional>
mediaAccessibleLabel
string <optional>
This will apply aria-label to Thumbnail. If it's not provided the media would be hidden from screen readers. thumbnailSrc
string <optional>
-
UnderflowMessageDetailParameters
-
Parameters that are passed into the selectionUnderflowMessageDetail callback function.
Properties:
Name Type Description min
number The minimum allowed number of selections.