Usage
Signature:
interface CMenuButtonElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CMenuButtonElement } from "oj-c/menu-button";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/menu-button";
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.
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.
-
endIcon
-
The endIcon slot is the button's end icon. The oj-c-menu-button element accepts DOM nodes as children with the endIcon slot.
-
startIcon
-
The startIcon slot is the button's start icon. The oj-c-menu-button element accepts DOM nodes as children with the startIcon slot.
Attributes
-
chroming :"ghost"|"borderless"|"outlined"|"solid"
-
Indicates in what states the button has chromings in background and border.
- Default Value:
"outlined"
Supported Values:
Value Description borderlessBorderless buttons are a more prominent variation. Borderless buttons are useful for supplemental actions that require minimal emphasis. ghostGhost buttons are the least prominent variation. Ghost buttons are useful for performing low-priority tasks, such as manipulating the UI. outlinedOutlined buttons are salient, but lighter weight than solid buttons. Outlined buttons are useful for secondary actions. solidSolid buttons stand out, and direct the user's attention to the most important actions in the UI. Names
Item Name Property chromingProperty change event chromingChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-chroming-changed -
disabled :boolean
-
Specifies that the button element should be 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 -
display :"all"|"icons"|"label"
-
Display just the label, the icons, or all. Label is used as tooltip and should be set in all cases.
- Default Value:
"all"
Supported Values:
Value Description allDisplay both the label and icons. iconsDisplay only the icons. labelDisplay only the text label. Names
Item Name Property displayProperty change event displayChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-changed -
items :Array.<(oj-c.MenuButton.MenuSeparator|oj-c.MenuButton.MenuItem|oj-c.MenuButton.MenuSubMenu|oj-c.MenuButton.MenuSelectSingle|oj-c.MenuButton.MenuSelectMultiple)>
-
Items describe the menu items rendered by the menu button.
- Default Value:
[]
Names
Item Name Property itemsProperty change event itemsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-items-changed -
label* :string
-
Text to show in the button.
- Default Value:
""
Names
Item Name Property labelProperty change event labelChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-label*-changed -
selection :Readonly<Record<string, MenuSelection>>
-
An array containing key/value objects for menu selection groups.
- Supports writeback:
true
Names
Item Name Property selectionProperty change event selectionChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-changed -
size :"xs"|"sm"|"md"|"lg"
-
Size of button
- Default Value:
"md"
Supported Values:
Value Description lgDisplay a large button. mdDisplay a default size button. smDisplay a small button. xsDisplay an extra small button. Only supported for component developers with ghost chroming in icon display mode. Names
Item Name Property sizeProperty change event sizeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-size-changed -
suffix :string
-
Suffix appended to menu label to indicate last selection.
Names
Item Name Property suffixProperty change event suffixChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-suffix-changed -
tooltip :string
-
Text to show in the tooltip. This overrides the default tooltip that renders the label when in icon mode.
Names
Item Name Property tooltipProperty change event tooltipChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-tooltip-changed -
width :(number|string)
-
Specifies that the button style width
Names
Item Name Property widthProperty change event widthChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-width-changed
Events
-
ojMenuAction
-
Triggered when a menu item is clicked, whether by keyboard, mouse, or touch events. Detail indicates which menu item was clicked.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type keystring -
ojMenuSelection
-
Triggered when a menu selection group item is clicked, whether by keyboard, mouse, or touch events. Detail indicates new selection value for group.
Properties:
All of the event payloads listed below can be found under
event.detail. See Events and Listeners for additional information.Name Type menuSelectionGroupKeystring valueT
Methods
-
blur : {void}
-
Returns:
- Type
- void
-
click : {void}
-
Returns:
- Type
- void
-
focus : {void}
-
Returns:
- Type
- void
-
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
-
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
Type Definitions
-
MenuItem
-
Specifies a standard menu item.
Properties:
Name Type Argument Description disabledboolean <optional>
Specifies if the menu item is disabled (enabled by default). endIcon{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the end of the menu item. keystring A unique key associated with the menu item. labelstring The menu item label. onActionfunction <optional>
Optional callback function associated with the menu item. startIcon{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the start of the menu item. type"item" <optional>
Specifies a standard menu item. variant"standard" | "destructive" <optional>
Specifies the menu item behavior. -
MenuSelectItem
-
Specifies a selectable item in a menu item.
Properties:
Name Type Argument Description disabledboolean <optional>
Specifies if the selectable item is disabled (enabled by default). endIcon{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the end of the selectable item. labelstring The selectable item label. valuestring The value associated with the selectable item. -
MenuSelectMultiple
-
Specifies a menu item representing a select multiple.
Properties:
Name Type Argument Description itemsArray.<oj-c.MenuButton.MenuSelectItem> <optional>
Specifies the array of select items that make up the select multiple. keystring A unique key associated with the select multiple. type"selectmultiple" Specifies a select multiple menu item. -
MenuSelectSingle
-
Specifies a menu item representing a select single.
Properties:
Name Type Argument Description itemsArray.<oj-c.MenuButton.MenuSelectItem> <optional>
Specifies the array of select items that make up the select single. keystring A unique key associated with the select single. type"selectsingle" Specifies a select single menu item. -
MenuSeparator
-
Specifies a menu separator:
{ type: "separator" }.- Deprecated:
-
Since Value Description 17.0.0divider Use 'separator' instead.
Properties:
Name Type Description typeseparator | divider Specifies a separator menu item. -
MenuSubMenu
-
Specifies a menu item representing a submenu.
Properties:
Name Type Argument Description disabledboolean <optional>
Specifies if the submenu is disabled (enabled by default). itemsArray<oj-c.MenuButton.MenuSeparator | oj-c.MenuButton.MenuItem | oj-c.MenuButton.MenuSubMenu | oj-c.MenuButton.MenuSelectSingle | oj-c.MenuButton.MenuSelectMultiple> <optional>
Specifies the array of menu items that make up the submenu. keystring <optional>
A unique key associated with the submenu menu item. labelstring <optional>
The submenu label. startIconstring <optional>
Optional icon to render at the start of the submenu. type"submenu" Specifies a submenu menu item.