Kendo

  • Kendo UI
  • Demos
  • Roadmap
  • Download Beta

Skin

  • Framework
  • UI Widgets
  • Integration

    Configure Animation Settings
    • First Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Second Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Third Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Fourth Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Fifth Item
      • Sub Item 1
      • Sub Item 2
      • Sub Item 3
      • Sub Item 4
    • Description
    • View Code
    • Configuration (4)
    • Methods (8)
    • Events (3)

    The Menu widget displays hierarchical data as a multi-level menu. Menus provide rich styling for unordered lists of items, and can be used for both navigation and executing JavaScript commands. Items can be defined and initialized from HTML, or the rich Menu API can be used to add and remove items.

    Getting Started

    Create a simple HTML hierarchical list of items

    <ul id="menu">
        <li>Item 1
            <ul>
                <li>Item 1.1</li>
                <li>Item 1.2</li>
            </ul>
        </li>
        <li>Item 2</li>
    </ul>

    Initialize Kendo Menu using jQuery selector

    var menu = $("#menu").kendoMenu();

    Customizing Menu Animations

    By default, the Menu uses a slide animation to expand and reveal sub-items as the mouse hovers. Animations can be easily customized using configuration properties, changing the animation style and delay. Menu items can also be configured to open on click instead of on hover.

    Changing Menu animation and open behavior

    $("#menu").kendoMenu({
         animation: {
           open : {effects: fadeIn},
           hoverDelay: 500
         },
         openOnClick: true
     });

    Dynamically configuring Menu items

    The Menu API provides several methods for dynamically adding or removing Items. To add items, provide the new item as a JSON object along with a reference item that will be used to determine the placement in the hierarchy.


    A reference item is simply a target Menu Item HTML element that already exists in the Menu. Any valid jQuery selector can be used to obtain a reference to the target item. For examples, see the Menu API demos. Removing an item only requires a reference to the target element that should be removed.

    Dynamically add a new root Menu item

     var menu = $("#menu").kendoMenu().data("kendoMenu");
     menu.insertAfter(
         { text: "New Menu Item" },
         menu.element.children("li:last")
     );
    No code
    animation: Object
    A collection of Animation objects, used to change default animations. A value of false will disable all animations in the component.
    close: Animation
    The animation that will be used when closing sub menus.
    open: Animation
    The animation that will be used when opening sub menus.
    hoverDelay: Number(default: 100)
    Specifies the delay in ms before the menu is opened/closed - used to avoid accidental closure on leaving.
    openOnClick: Boolean(default: false)
    Specifies that the root sub menus will be opened on item click.
    orientation: String(default: "horizontal")
    Root menu orientation.
    • append (item, referenceItem)
      Appends a Menu item in the specified referenceItem's sub menu

      Example

      menu.append(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Item
      A reference item to append the new item in
    • close (element)
      Closes the sub menu of the specified Menu item/s

      Example

      menu.close("#Item1");

      Parameters

      element: Selector
      Target item selector.
    • disable (element)
      Disables a Menu item

      Parameters

      element: Selector
      Target element
    • enable (element, enable)
      Enables/disables a Menu item

      Parameters

      element: Selector
      Target element
      enable: Boolean
      Desired state
    • insertAfter (item, referenceItem)
      Inserts a Menu item after the specified referenceItem

      Example

      menu.insertAfter(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Selector
      A reference item to insert the new item after
    • insertBefore (item, referenceItem)
      Inserts a Menu item before the specified referenceItem

      Example

      menu.insertBefore(
          [{
              text: "Item 1"
          },
          {
              text: "Item 2"
          }],
          referenceItem
      );

      Parameters

      item: Selector
      Target item, specified as a JSON object. Can also handle an array of such objects.
      referenceItem: Selector
      A reference item to insert the new item before
    • open (element)
      Opens the sub menu of the specified Menu item/s

      Example

      menu.open("#Item1");

      Parameters

      element: Selector
      Target item selector.
    • remove (element)
      Removes the specified Menu item/s from the Menu

      Example

      menu.remove("#Item1");

      Parameters

      element: Selector
      Target item selector.
    close
    Fires after a sub menu gets closed.

    Event data

    item : Element
    The closed item
    open
    Fires before a sub menu gets opened.

    Event data

    item : Element
    The opened item
    select
    Fires when a menu item gets selected.

    Event data

    item : Element
    The selected item
    • Home
    • Kendo UI
    • Demos
    • Roadmap
    • Blogs
    • Forums
    • Documentation
    • FAQ
    • About
    • Follow us on Twitter
    • Subscribe to our RSS feed

    Kendo UI is powered by Telerik

    Copyright © 2011 Telerik Inc. All rights reserved.