The Shell.Menubar and Shell.Menubar.Item components provide container elements for the menu area of the Shell3 pattern. The Shell.Menu component supports the opening and closing of a Menu.Item in an overlay.
Several Shell3 components are intended to work as menu items, such as the Shell.OrgSwitcher, Shell.SolutionSwitcher, Shell.Help, and Shell.User components.
See the Shell 3 documentation, which includes a shell pattern layout diagram, for more details. An example of the Shell3 pattern in action is provided in the coralui-example-shell3 project.
Coral.Shell.MenuBar API
Constructor
JavaScript:
-
new Coral.Shell.MenuBar()ordocument.createElement('coral-shell-menubar') HTML Tag:
-
<coral-shell-menubar>
Extends
Sub-components
Instance Properties
-
instance.hidden {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- hidden
-
instance.items {Coral.Collection}
Readonly -
Whether this component is hidden or not.
The item collection.
See Coral.Collection for more details.
Methods
-
instance.get
-
- Parameters:
-
Name Type Description property String The name of the property to fetch the value of. - Returns:
-
Property value. {*}
- Inherited From:
-
instance.hide
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.off
-
- Parameters:
-
Name Type Optional Description eventName String No
The event name to stop listening for. selector String Yes
The selector that was used for event delegation. func function No
The function that was passed to on().useCapture Boolean Yes
Only remove listeners with useCaptureset to the value passed in. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.on
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to listen for. selector String Yes
The selector to use for event delegation. func function No
The function that will be called when the event is triggered. useCapture Boolean Yes
Whether or not to listen during the capturing or bubbling phase. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.remove
-
- Inherited From:
-
instance.set
-
- Parameters:
-
Name Type Description property String The name of the property to set. value * The value to set the property to. silent Boolean If true, events should not be triggered as a result of this set. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.show
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.trigger
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to trigger. props Object Yes
Additional properties to make available to handlers as event.detail.bubbles Boolean Yes
Set to falseto prevent the event from bubbling.cancelable Boolean Yes
Set to falseto prevent the event from being cancelable. - Returns:
-
CustomEvent object {CustomEvent}
- Inherited From:
Get the value of a property.
Hide this component.
Remove an event listener.
Add an event listener.
Non-destructively remove this element. It can be re-added by simply appending it to the document again.
It will be garbage collected if there are no more references to it.
Set a single property.
Show this component.
Trigger an event.
Events
-
coral-component:attached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:detached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:ready
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.9.0, use
Coral.commons.ready()instead.
- since 1.9.0, use
Triggered when the component is attached to the DOM.
Triggered when the component is detached to the DOM.
Triggerred when the component has been upgraded and is ready for use.
Coral.Shell.MenuBar.Item API
Constructor
JavaScript:
-
new Coral.Shell.MenuBar.Item()ordocument.createElement('coral-shell-menubar-item') HTML Tag:
-
<coral-shell-menubar-item>
Extends
Static Properties
-
Coral.Shell.MenuBar.Item.iconVariant {String}
-
Properties:
Name Type Value Description DEFAULT String default A default menubar item CIRCLE String circle A round image as menubar item
Enum for menubar item iconVariant.
Instance Properties
-
instance.badge {String}
-
- Default Value:
- ""
- HTML Attribute:
- badge
-
instance.hidden {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- hidden
-
instance.icon {String}
-
- Default Value:
- ""
- HTML Attribute:
- icon
- See:
-
instance.iconSize {Coral.Icon.size}
-
- Default Value:
- Coral.Icon.size.SMALL
- HTML Attribute:
- iconsize
- See:
-
instance.iconVariant {Coral.Shell.MenuBar.Item.iconVariant}
-
- Default Value:
- Coral.Shell.MenuBar.Item.iconVariant.DEFAULT
- HTML Attribute:
- iconvariant
-
instance.label {HTMLElement}
-
-
instance.menu {HTMLElement | String}
-
- Default Value:
- null
- HTML Attribute:
- menu
-
instance.open {Boolean}
Reflected -
- Default Value:
- false
- HTML Attribute:
- open
The notification badge content.
Whether this component is hidden or not.
Specifies the icon name used inside the menu item.
See Coral.Icon for valid icon names.
Size of the icon. It accepts both lower and upper case sizes.
The menubar item's iconVariant.
The menubar item's label content zone.
The menu that this menu item should show. If a CSS selector is provided, the first matching element will be
used.
Whether the menu is open or not.
Methods
-
instance.get
-
- Parameters:
-
Name Type Description property String The name of the property to fetch the value of. - Returns:
-
Property value. {*}
- Inherited From:
-
instance.hide
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.off
-
- Parameters:
-
Name Type Optional Description eventName String No
The event name to stop listening for. selector String Yes
The selector that was used for event delegation. func function No
The function that was passed to on().useCapture Boolean Yes
Only remove listeners with useCaptureset to the value passed in. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.on
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to listen for. selector String Yes
The selector to use for event delegation. func function No
The function that will be called when the event is triggered. useCapture Boolean Yes
Whether or not to listen during the capturing or bubbling phase. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.remove
-
- Inherited From:
-
instance.set
-
- Parameters:
-
Name Type Description property String The name of the property to set. value * The value to set the property to. silent Boolean If true, events should not be triggered as a result of this set. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.show
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.trigger
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to trigger. props Object Yes
Additional properties to make available to handlers as event.detail.bubbles Boolean Yes
Set to falseto prevent the event from bubbling.cancelable Boolean Yes
Set to falseto prevent the event from being cancelable. - Returns:
-
CustomEvent object {CustomEvent}
- Inherited From:
Get the value of a property.
Hide this component.
Remove an event listener.
Add an event listener.
Non-destructively remove this element. It can be re-added by simply appending it to the document again.
It will be garbage collected if there are no more references to it.
Set a single property.
Show this component.
Trigger an event.
Events
-
coral-component:attached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:detached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:ready
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.9.0, use
Coral.commons.ready()instead.
- since 1.9.0, use
-
coral-shell-menubar-item:close
-
- Callback Parameters:
-
Name Type Description event Object Event object.
-
coral-shell-menubar-item:open
-
- Callback Parameters:
-
Name Type Description event Object Event object.
Triggered when the component is attached to the DOM.
Triggered when the component is detached to the DOM.
Triggerred when the component has been upgraded and is ready for use.
Triggerred after the component is closed with
hide() or instance.open = false
Triggerred after the overlay is opened with
show() or instance.open = true
Coral.Shell.Menu API
Constructor
JavaScript:
-
new Coral.Shell.Menu()ordocument.createElement('coral-shell-menu') HTML Tag:
-
<coral-shell-menu>
Extends
Static Properties
-
Coral.Shell.Menu.from {Object}
-
Properties:
Name Type Value Description RIGHT Object right Animate in from the right. TOP Object top Animate in from the top. -
Coral.Shell.Menu.placement {Object}
-
Properties:
Name Type Value Description RIGHT Object right Anchor to the right of the page. TOP Object top Anchor at the top of the page.
Overlay animation directions.
Overlay placement values.
Instance Properties
-
instance.focusOnShow {Coral.mixin.overlay.focusOnShow | HTMLElement | String}
-
- Inherited From:
- Default Value:
- HTML Attribute:
- focusonshow
-
instance.from {Coral.Shell.Menu.from}
-
- Default Value:
- Coral.Shell.Menu.from.TOP
- HTML Attribute:
- from
-
instance.full {Boolean}
-
- Default Value:
- false
- HTML Attribute:
- full
-
instance.hidden {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- hidden
-
instance.open {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- open
-
instance.placement {Coral.Shell.Menu.placement}
-
- Default Value:
- Coral.Shell.Menu.placement.RIGHT
- HTML Attribute:
- placement
-
instance.returnFocus {Coral.mixin.overlay.returnFocus}
-
- Inherited From:
- Default Value:
- Coral.mixin.overlay.returnFocus.OFF
- HTML Attribute:
- returnfocus
-
instance.top {Boolean}
-
- Default Value:
- false
- HTML Attribute:
- full
-
instance.trapFocus {Coral.mixin.overlay.trapFocus}
-
- Inherited From:
- Default Value:
- Coral.mixin.overlay.trapFocus.OFF
- HTML Attribute:
- trapfocus
Whether to focus the overlay, when opened or not (default='off').
If set to 'on', the overlay itself will get focus.
This property also accepts an instance of HTMLElement or a selector like ':first-child' or 'button:last-of-type'
and will focus the first element found inside the overlay instead of the overlay itself.
The direction the overlay should animate from.
Whether the overlay should use all available space.
Whether this component is hidden or not.
Whether this overlay is open or not.
The side of the page the overlay should be anchored to.
Whether to return focus to the previously focused element when closed.
Whether the overlay should always be on top.
Whether to trap tabs and keep them within the overlay.
Methods
-
instance.get
-
- Parameters:
-
Name Type Description property String The name of the property to fetch the value of. - Returns:
-
Property value. {*}
- Inherited From:
-
instance.hide
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.off
-
- Parameters:
-
Name Type Optional Description eventName String No
The event name to stop listening for. selector String Yes
The selector that was used for event delegation. func function No
The function that was passed to on().useCapture Boolean Yes
Only remove listeners with useCaptureset to the value passed in. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.on
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to listen for. selector String Yes
The selector to use for event delegation. func function No
The function that will be called when the event is triggered. useCapture Boolean Yes
Whether or not to listen during the capturing or bubbling phase. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.remove
-
- Inherited From:
-
instance.returnFocusTo
-
- Parameters:
-
Name Type Description element HTMLElement The element to return focus to. This must be a DOM element, not a jQuery object or selector. - Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.set
-
- Parameters:
-
Name Type Description property String The name of the property to set. value * The value to set the property to. silent Boolean If true, events should not be triggered as a result of this set. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.show
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.trigger
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to trigger. props Object Yes
Additional properties to make available to handlers as event.detail.bubbles Boolean Yes
Set to falseto prevent the event from bubbling.cancelable Boolean Yes
Set to falseto prevent the event from being cancelable. - Returns:
-
CustomEvent object {CustomEvent}
- Inherited From:
Get the value of a property.
Hide this component.
Remove an event listener.
Add an event listener.
Non-destructively remove this element. It can be re-added by simply appending it to the document again.
It will be garbage collected if there are no more references to it.
Set the element that focus should be returned to when the overlay is hidden.
Set a single property.
Show this component.
Trigger an event.
Events
-
coral-component:attached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:detached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserverinstead.
- since 1.14.0, use
-
coral-component:ready
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.9.0, use
Coral.commons.ready()instead.
- since 1.9.0, use
-
coral-overlay:beforeclose
-
- Callback Parameters:
-
Name Type Description event Object Event object.
Name Type Description event.preventDefault function Call to stop the overlay from closing.
- Inherited From:
-
coral-overlay:beforeopen
-
- Callback Parameters:
-
Name Type Description event Object Event object.
Name Type Description event.preventDefault function Call to stop the overlay from opening.
- Inherited From:
-
coral-overlay:close
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
-
coral-overlay:open
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
Triggered when the component is attached to the DOM.
Triggered when the component is detached to the DOM.
Triggerred when the component has been upgraded and is ready for use.
Triggerred before the component is closed with
hide() or instance.open = false.
Triggerred before the component is opened with
show() or instance.open = true.
Triggerred after the component is closed with
hide() or instance.open = false
Triggerred after the overlay is opened with
show() or instance.open = true