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.
- Deprecated:
-
Since Description 6.0.0
This value will be removed in the future. Please use solid instead. - Deprecated:
-
Since Description 6.0.0
This value will be removed in the future. Please use borderless instead.
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. half
In typical themes, half-chrome buttons acquire chrome only in their hover, active, and selected states. 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 theirdisabled
attributes. Thus, a Button is effectively disabled if either its owndisabled
attribute is set, or the Buttonset'sdisabled
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.- Default Value:
"all"
Supported Values:
Value Description all
Display both the label and icons. icons
Display only the icons. label
Display only the label. 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.- Default Value:
"oneTabstop"
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. 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 whichoj-option
s in the Buttonset are selected. It corresponds to thevalue
attribute of those elements, which should always be set.value
is a possibly empty, non-null
string array containing thevalue
attributes of the selectedoj-option
s. This array has "set", not "list", semantics; i.e. order is neither important nor guaranteed. Thus, an n-oj-option
set has 2^n validvalue
values: the 2^n possible subsets of noj-option
s.In all other cases,
value
isnull
.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 thevalue
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 callrefresh
(as in all cases when the DOM changes underneath a component), and then update thevalue
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 thevalue
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 attributevalue
binding and/or thevalueChange
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
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
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
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");