Element: <oj-buttonset-many>

Oracle® JavaScript Extension Toolkit (JET)
17.1.0

G12196-01

Since:
  • 0.6.0
Module:
  • ojbutton

QuickNav

Attributes


JET Buttonset Many

Description: Themeable, WAI-ARIA-compliant visual and semantic grouping container for JET Buttons.

The JET ButtonsetMany can be used to group related buttons, where any number of the buttons can be selected. Buttonset provides visual and semantic grouping and WAI-ARIA-compliant focus management.

When a Buttonset is created or refreshed, it creates JET Buttons out of all contained oj-option DOM elements by wrapping them and calling .ojButton() on the generated content. The Buttonset will remove all non oj-option DOM elements from the Buttonset.

oj-options in the buttonset should specify the oj-option value attribute, since the oj-buttonset-mnay value attribute refers to that attribute.

<oj-buttonset-many id="myButtonset">
  <oj-option value="myValue0">Value0</oj-option>
  <oj-option value="myValue1">Value1</oj-option>
</oj-buttonset-many>

Touch End User Information

All Buttonset touch interaction is with the individual buttons. See the JET Button touch gesture doc.

Keyboard End User Information

JET Buttonset is a single tabstop, with arrow-key navigation within the buttonset, as follows:

Key Action
LeftArrow Navigate to the previous enabled button on the left, wrapping around at the end.
RightArrow Navigate to the next enabled button on the right, wrapping around at the end.

See also the JET Button keyboard doc, for details on interacting with the individual buttons.

Keyboard Application Developer Information

The application should not do anything to interfere with the Buttonset's focus management, such as setting the tabindex of the buttons. Also, enabled buttons should remain user-visible, without which arrow-key navigation to the button would cause the focus to seemingly disappear.

The buttonset's focus management should be turned off when placing the buttonset in a JET Toolbar. See the focusManagement attribute. In this case, the "Keyboard End User Information" documented above is superseded by the Toolbar's documented keyboard behavior.

Migration

To migrate from oj-buttonset-many to oj-c-buttonset-multiple, or oj-buttonset-one to oj-c-buttonset-single, you need to revise the import statement and references to oj-c-buttonset-multiple, or oj-c-buttonset-single in your app. Please note the changes between the components below. Note that oj-c-toggle-button should be used instead of oj-c-buttonset-multiple, as it provide superior speed, though oj-c-buttonset-multiple with a single button will function properly.

oj-c-buttonset-multiple no longer supports DOM-centric options specified in the default slot. Instead, the toggles are specified in the items property. Sizes, layout widths, widths, max width, and edge behavior are all now done via properties instead of style classes or styling. Tooltip replaces title. Solid chroming is no longer supported. For oj-c-toggle-button, a value and label are used on the button, instead of having a value on a containing buttonset.

Accessibility

The application is responsible for applying aria-label and/or aria-controls attributes like the following to the buttonset element, if applicable per the instructions that follow:

aria-label="Choose only one beverage."
aria-controls="myTextEditor"

An aria-label conveying the "choose only one" semantics should be included for a buttonset-one.

The aria-controls attribute should be included if the buttonset is controlling something else on the page, e.g. bold / italic / underline buttons controlling a rich text editor. If the buttonset is contained in a toolbar, aria-controls should be placed on the toolbar, not on the buttonsets within the toolbar.

Disabled content: JET supports an accessible luminosity contrast ratio, as specified in WCAG 2.0 - Section 1.4.3 "Contrast", in the themes that are accessible. (See the "Theming" chapter of the JET Developer Guide for more information on which themes are accessible.) Note that Section 1.4.3 says that text or images of text that are part of an inactive user interface component have no contrast requirement. Because disabled content may not meet the minimum contrast ratio required of enabled content, it cannot be used to convey meaningful information.

Reading direction

The only supported way to set the reading direction (LTR or RTL) is to set the "dir" attribute on the <html> element of the page. As with any JET component, in the unusual case that the reading direction is changed post-create, the buttonset must be refresh()ed, or the page must be reloaded.

Declarative Binding

For components like Buttonset and Menu that contain a number of like items, applications may wish to use an oj-bind-for-each to stamp out the contents as follows:

<oj-buttonset-many id="drinkset">
      <oj-bind-for-each data="[[drinkValues]]">
        <template>
          <oj-option value="[[$current.data.id]]">
            <span>
              <oj-bind-text value="[[$current.data.label]]"></oj-bind-text>
            </span>
          </oj-option>
        </template>
      </oj-bind-for-each>
  </oj-buttonset-many>


Usage

Signature:

interface ButtonsetManyElement

Typescript Import Format
//To typecheck the element APIs, import as below.
import { ButtonsetManyElement } from "ojs/ojbutton";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojbutton";

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.


Styling Classes

.oj-buttonset-width-auto

Forces Buttonset Buttons' widths to be determined by the total width of their icons and label contents, overriding any theming defaults.

Optionally, specify the overall width of the Buttonset for further width control.

Can be applied to Buttonset's root element, or on an ancestor such as Toolbar or document.

.oj-buttonset-width-equal

Forces Buttonset Buttons' widths to be equal, overriding any theming defaults.

Note that the overall width of the Buttonset defaults to 100%; set the max-width (recommended) or width of the Buttonset for further width control.

Can be applied to Buttonset's root element, or on an ancestor such as Toolbar or document.

Category: Button Size

Makes the button small or large.

Classes:

.oj-button-sm
.oj-button-lg

Slots

JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

Default

The <oj-buttonset-many> element accepts oj-option elements as children. See the oj-option documentation for details about accepted children and slots.

contextMenu

The contextMenu slot is set on the oj-menu within this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.

The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.

To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc of the individual components for details.

Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.

Deprecated:
Since Description
13.0.0 This web component no longer supports launching a context menu.

Attributes

chroming :"solid"|"outlined"|"borderless"|"full"|"half" chroming :"solid"|"outlined"|"borderless"

Indicates in what states the buttonset's buttons have chrome (background and border).

A buttonset's chroming must be set by setting this buttonset attribute (or setting the chroming attribute of a containing toolbar).

The default chroming varies by theme and containership as follows:

  • If the buttonset is in a toolbar, then the default chroming is the current value of the toolbar's chroming attribute.
  • Else, the default chroming value is controlled by the theme.

Once a value has been set on this buttonset attribute, that value applies regardless of theme and containership.

Supported Values:
Value Description
borderless Borderless buttons are the least prominent variation. Borderless buttons are useful for supplemental actions that require minimal emphasis.
full Please use solid instead. In typical themes, full-chrome buttons always have chrome.
Deprecated:
Since Description
6.0.0 This value will be removed in the future. Please use solid instead.
half In typical themes, half-chrome buttons acquire chrome only in their hover, active, and selected states.
Deprecated:
Since Description
6.0.0 This value will be removed in the future. Please use borderless instead.
outlined Outlined buttons are salient, but lighter weight than solid buttons. Outlined buttons are useful for secondary actions.
solid Solid buttons stand out, and direct the user's attention to the most important actions in the UI. Note that this option is not supported in the Redwood theme.
Names
Item Name
Property chroming
Property change event chromingChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-chroming-changed

(nullable) described-by :string

The oj-label sets the described-by attribute programmatically on the buttonset component. This attribute is not meant to be set by an application developer directly. The described-by is copied to the aria-describedby attribute on the component's inner dom element, and it is needed for accessibility.
Names
Item Name
Property describedBy
Property change event describedByChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-described-by-changed

disabled :boolean

Setting the Buttonset's disabled attribute effectively disables all its Buttons, without affecting their disabled attributes. Thus, a Button is effectively disabled if either its own disabled attribute is set, or the Buttonset's disabled attribute is set.

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

display :"all"|"icons"|"label"

Whether to display both the label and icons ("all") or just the label ("label") or just the icons ("icons") of the buttons. In the latter case, the label is displayed in a tooltip instead.

The display attribute will be ignored if no icons exist in the button.

Supported Values:
Value Description
all Display both the label and icons.
icons Display only the icons.
label Display only the label.
Default Value:
  • "all"
Names
Item Name
Property display
Property change event displayChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-changed

focus-management :"oneTabstop"|"none"

The focusManagement attribute should be set to "none" when the Buttonset is placed in a JET Toolbar. This allows the Toolbar to manage the focus with no interference from the Buttonset, so that arrow keys move within the entire Toolbar, not just within the Buttonset.
Supported Values:
Value Description
none Focus management is disabled, to avoid interfering with the focus management of a containing component.
oneTabstop Focus management is enabled. The Buttonset is a single tabstop with arrow-key navigation.
Default Value:
  • "oneTabstop"
Names
Item Name
Property focusManagement
Property change event focusManagementChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-focus-management-changed

labelled-by :string|null

It is used to establish a relationship between this component and another element. A common use is to tie the oj-label and the oj-buttonset together for accessibility. The oj-label custom element has an id, and you use the labelled-by attribute to tie the two components together to facilitate correct screen reader behavior.
Names
Item Name
Property labelledBy
Property change event labelledByChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-labelled-by-changed

translations :object|null

A collection of translated resources from the translation bundle, or null if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.

If the component does not contain any translatable resource, the default value of this attribute will be null. If not, an object containing all resources relevant to the component.

If this component has translations, their documentation immediately follows this doc entry.

Names
Item Name
Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-translations-changed

value :Array.<any>|null

The value attribute indicates which oj-options in the Buttonset are selected. It corresponds to the value attribute of those elements, which should always be set. value is a possibly empty, non-null string array containing the value attributes of the selected oj-options. This array has "set", not "list", semantics; i.e. order is neither important nor guaranteed. Thus, an n-oj-option set has 2^n valid value values: the 2^n possible subsets of n oj-options.

In all other cases, value is null.

It's still possible for the value attribute and DOM to get out of sync by other means. In this case, the app is responsible for updating the value attribute. A typical case is when the set of Buttons contained in the Buttonset changes, possibly due to a Knockout binding, in which case the app must first call refresh (as in all cases when the DOM changes underneath a component), and then update the value attribute to the desired value.

Often there is no need to listen for this event, since the value binding, discussed above, will update the bound observable whenever the value state changes. The declarative binding is often preferable to an explicit listener.

A click listener should not be used to detect changes to the value state. The attribute value binding and/or the valueChange event should be used instead.

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

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Since:
  • 4.0.0
Returns:
Type
any
Example

Get a single subproperty of a complex property:

let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');

refresh : {void}

Refreshes the component.
Returns:
Type
void

setProperties(properties) : {void}

Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a batch of properties:

myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});

setProperty(property, value) : {void}

Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a single subproperty of a complex property:

myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");