Element: <oj-buttonset-one>

Oracle® JavaScript Extension Toolkit (JET)




PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

  • 4.2.0
  • 0.6

JET Custom Elements

JET components are implemented as custom HTML elements. A detailed description of working with these elements can be found in: JET Custom Element Usage.

JET Buttonset One

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

The JET ButtonsetOne can be used to group related buttons, where only one button may 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 inside of the buttonset should specify the oj-option value attribute, since the oj-buttonset-one value attribute refers to that attribute.

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

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.


As shown in the online demos, 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."

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.


The following CSS classes can be applied by the page author as needed.

Class Description
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.

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 a foreach Knockout binding to stamp out the contents. This binding cannot live on the same node as the ojComponent binding, and must instead live on a nested virtual element as follows:

<oj-buttonset-one id="drinkset">
      <!-- ko foreach: drinkValues -->
      <oj-option value="[[id]]">
          <span data-bind="text: label"></span>
      <!-- /ko -->

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.


JET elements can have up to two types of child content:

  • Any child element with a slot attribute will be moved into that named slot, e.g. <span slot='startIcon'>...</span>. All supported named slots are documented below. Child elements with unsupported named slots will be removed from the DOM.
  • Any child element lacking a slot attribute will be moved to the default slot, also known as a regular child. This is documented under the "Default" heading below.


The <oj-buttonset-one> element accepts oj-options as children. See the oj-option doc for details about accepted children and slots.


Initialize the Buttonset with child content specified:

  <oj-option value="myValue">myValue</oj-option>


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 and demos 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.


Initialize the component with a context menu:

    <-- use the contextMenu slot to designate this as the context menu for this component -->
    <oj-menu slot="contextMenu" style="display:none" aria-label="Some element's context menu">


<static> chroming :string|undefined

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, if $buttonsetChromingOptionDefault is set in the current theme as seen in the example below, then that value is the chroming default.
  • Else, the default chroming is "full".

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

Supported Values:
Name Type Description
"full" string In typical themes, full-chrome buttons always have chrome.
"half" string In typical themes, half-chrome buttons acquire chrome only in their hover, active, and selected states. Half-chroming is recommended for buttons in a toolbar. (This is the toolbar default in most themes.)
"outlined" string In typical themes, outlined buttons are similar to half-chrome buttons, but have a border in the default state.
Item Name
Property chroming
Property change event chromingChanged
Property change listener attribute (must be of type function) on-chroming-changed

Initialize the Buttonset with the chroming attribute specified:

<oj-buttonset-one chroming='half'></oj-buttonset-one>

Get or set the chroming property after initialization:

// getter
var chromingValue = myButtonset.chroming;

// setter
myButtonset.chroming = 'half';

Set the default in the theme (SCSS) :

$buttonsetChromingOptionDefault: half !default;

<static> 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
Item Name
Property disabled
Property change event disabledChanged
Property change listener attribute (must be of type function) on-disabled-changed

Initialize the Buttonset with the disabled attribute specified:

<oj-buttonset-one disabled='true'></oj-buttonset-one>

Get or set the disabled property after initialization:

// getter
var disabledValue = myButtonset.disabled;

// setter
myButtonset.disabled = true;

<static> display :string

Whether to display both the label and icons ("all") 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:
Name Type Description
"all" string Display both the label and icons.
"icons" string Display only the icons.
Default Value:
  • "all"
Item Name
Property display
Property change event displayChanged
Property change listener attribute (must be of type function) on-display-changed

Initialize the Buttonset with the display attribute specified:

<oj-buttonset-one display='icons'></oj-buttonset-one>

Get or set the display property after initialization:

// getter
var displayValue = myButtonset.display;

// setter
myButtonset.display = 'icons';

<static> focus-management :string

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:
Name Type Description
"none" string Focus management is disabled, to avoid interfering with the focus management of a containing component.
"oneTabstop" string Focus management is enabled. The Buttonset is a single tabstop with arrow-key navigation.
Default Value:
  • "oneTabstop"
Item Name
Property focusManagement
Property change event focusManagementChanged
Property change listener attribute (must be of type function) on-focus-management-changed

Initialize the Buttonset with the focusManagement attribute specified:

<oj-buttonset-one focus-management='none'></oj-buttonset-one>

Get or set the focusManagement property after initialization:

// getter
var focusManagementValue = myButtonset.focusManagement;

// setter
myButtonset.focusManagement = 'none';

translations :Object

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 this component has translations, their documentation immediately follows this doc entry.

Default Value:
  • an object containing all resources relevant to the component, or null if none
Item Name
Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function) on-translations-changed

Initialize the component, overriding some translated resources and leaving the others intact:

<!-- Using dot notation -->
<oj-some-element translations.some-key='some value' translations.some-other-key='some other value'></oj-some-element>

<!-- Using JSON notation -->
<oj-some-element translations='{"someKey":"some value", "someOtherKey":"some other value"}'></oj-some-element>

Get or set the translations property after initialization:

// Get one
var value = myComponent.translations.someKey;

// Set one, leaving the others intact. Always use the setProperty API for 
// subproperties rather than setting a subproperty directly.
myComponent.setProperty('translations.someKey', 'some value');

// Get all
var values = myComponent.translations;

// Set all.  Must list every resource key, as those not listed are lost.
myComponent.translations = {
    someKey: 'some value',
    someOtherKey: 'some other value'

<static> value :*

The value attribute indicates which oj-option in the Buttonset is selected. It corresponds to the value attribute of the oj-option, which should always be set. value is any type equal to the value attribute of the selected oj-option. The attribute is null if and only if no oj-option is selected. Thus, an n-oj-option group has n+1 valid value values: the n oj-option values, and null .

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
Item Name
Property value
Property change event valueChanged
Property change listener attribute (must be of type function) on-value-changed

Initialize the Buttonset with the value attribute specified:

<oj-buttonset-one value='bold'></oj-buttonset-one>

Get or set the value property after initialization:

// Get one
var value = myButtonset.value;

// Set one.  (No property change event will be fired.)
myButtonset.value = 'bold';


getProperty(property) → {*}

Retrieves a value for a property or a single subproperty for complex properties.
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.

Get a single subproperty of a complex property:

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


Refreshes the component.


Performs a batch set of properties.
Name Type Description
properties Object An object containing the property and value pairs to set.

Set a batch of properties:

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

setProperty(property, value)

Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value * The new value to set the property to.

Set a single subproperty of a complex property:

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