data-kt-menu-{parameter}
values are compatible with
Bootstrap breakpoint sizing
sm, md, lg, xl, xxl
. For responsive options, this attribute value must be written as an object string to enable multiple responsive breakpoints.data-kt-menu-trigger="{default:'click', 'lg': 'hover'}"
indicates that the drawer view component has
bottom
position value width on screens larger than
lg
and
top
for every other screen size.Name | Type | Description |
---|---|---|
data-kt-menu-trigger
|
mandatory
|
Sets the menu item submenu trigger method. Accepts values
click or
hover . |
data-kt-menu-placement
|
mandatory
|
KTMenu uses
Popper library for dropdown position relative the the trigger element. Accepts values
top ,
top-start ,
top-end ,
bottom ,
bottom-start ,
bottom-end ,
left ,
left-start ,
left-end ,
right ,
right-start and
right-end . For more info check. |
data-kt-menu-static="true"
|
optional
|
Sets the menu item submenu static to avoid closing it on page body click. Accepts values
true or
false . |
data-kt-menu-offset
|
optional
|
Sets the menu offset position relative the trigger element. Accepts upto 2 offset values in
px . For example
data-kt-menu-offset="0,20" . The first number indicates the horizontal offset value and the second number indicates the vertical offset value. |
data-kt-menu-toggle
|
optional
|
Sets the menu item submenu toggle mode. Accepts boolean values
true or
false . |
data-kt-menu-permanent
|
optional
|
Sets the menu item dropdown permanent to prevent it from closing on click on it and its children. Accepts boolean values
true or
false . |
data-kt-menu-overflow
|
optional
|
Populates the menu item dropdown under
body element instead of under the item element. This option is useful when the menu parent has
overflow: hidden style. Accepts boolean values
true or
false . |
data-kt-menu-attach
|
optional
|
Attaches the dropdown menu to the item's parent element, instead to the item itself. Accepts a string value
parent or any query string for an HTML element
#some_parent_element . |
data-kt-menu-height
|
optional
|
Sets dropdown custom height. Accepts CSS
px or
rem values. |
data-kt-menu-width
|
optional
|
Sets dropdown custom width. Accepts CSS
px or
rem values. |
Name | Description |
---|---|
Static Methods | |
createInstances(DOMString selector)
|
Initializes Bootstrap Menu instances by selector. Default value of
selector is
[data-kt-menu="true"] . This method can be used to initialize dynamicly populated Bootstrap Menu instances(e.g: after Ajax request).
|
getInstance(DOMElement element): KTMenu
|
Get the KTMenu instance created
|
updateDropdowns()
|
Updates dropdown by recalculating its styles and positions.
|
updateByLinkAttribute(String value, String name = "href")
|
Updates all existing menus instances active links state based on given attribute value.
|
hideDropdowns()
|
Hides currently shown Menu Dropdowns
|
Public Methods | |
show(DOMElement item)
|
Shows submenu(accordion or dropdown) of given menu item.
|
hide(DOMElement item)
|
Hides submenu(accordion or dropdown) of given menu item.
|
toggle(DOMElement item)
|
Toggles(show or hide) submenu(accordion or dropdown) of given menu item.
|
hideAccordions(DOMElement item)
|
Hides accordions of given menu item.
|
reset(DOMElement item)
|
Resets submenu states(
.active ,
.here ,
.show classes) of given menu item.
|
update()
|
Updates all submenu states.
|
getLinkByAttribute(String value, String name = "href")
|
Gets menu link DOM object by attribute value
|
setActiveLink(DOMElement link)
|
Sets the active state for given menu link element:
|
getElement(): DOMElement
|
Returns DOM element of menu.
|
getItemLinkElement(DOMElement item): DOMElement
|
Returns DOM element of link for give menu item
.menu-item .
|
getItemToggleElement(DOMElement item): DOMElement
|
Returns DOM element of toggle for give menu item
.menu-item .
|
getItemSubElement(DOMElement item): DOMElement
|
Returns DOM element of submenu for give menu item
.menu-item .
|
getItemParentElements(DOMElement item): DOMElement
|
Returns DOM elements of parent items for give menu item
.menu-item .
|
isItemSubShown(DOMElement item): Boolean
|
Checks whether item submenu is shown.
|
isItemParentShown(DOMElement item): DOMElement
|
Checks whether item parent is shown.
|
isItemDropdownPermanent(DOMElement item): Boolean
|
Checks whether item parent is shown in Boolean.
|
getTriggerElement(DOMElement item): DOMElement
|
Returns menu trigger element's DOM object.
|
on(String eventName, Function handler)
|
Attaches a handler to a custom event.
|
one(String eventName, Function handler)
|
Attaches a handler to a custom event that is executed at most once per.
|
off(String eventName)
|
Deattaches a handler from a custom event.
|
destroy()
|
Removes the component instance from element.
|
Event Type | Description |
---|---|
kt.menu.link.click
|
This event fires on after the menu link
.menu-link is clicked and before it's processed.
|
kt.menu.link.clicked
|
This event fires on after the menu link
.menu-link is clicked and processed.
|
kt.menu.dropdown.show
|
This event fires on before menu item
.menu-item dropdown is shown.
|
kt.menu.dropdown.shown
|
This event fires on after menu item
.menu-item dropdown is shown.
|
kt.menu.dropdown.hide
|
This event fires on before menu item
.menu-item dropdown is hidden.
|
kt.menu.dropdown.hidden
|
This event fires on after menu item
.menu-item dropdown is hidden.
|
kt.menu.accordion.show
|
This event fires on before menu item
.menu-item accordion is shown.
|
kt.menu.accordion.shown
|
This event fires on after menu item
.menu-item accordion is shown.
|
kt.menu.accordion.hide
|
This event fires on before menu item
.menu-item accordion is hidden.
|
kt.menu.accordion.hidden
|
This event fires on after menu item
.menu-item accordion is hidden.
|