# Opening and Closing

The Kendo UI Menu provides flexible options to customize how its items open and close. By default, items with children open on `mouseenter` and close on `mouseleave` with a small delay. This behavior can be adjusted using the following options:

<Row>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#delay-on-hover">
      <ComponentTitle>Configuring the Hover Delay</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Set the delay before menu items open or close on hover using the hoverDelay property.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#opening-on-click">
      <ComponentTitle>Opening the Menu on Click</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Configure menu items to open on click instead of hover with openOnClick settings.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#toggling-menu-item-manually">
      <ComponentTitle>Opening Menu Items Manually</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Programmatically open or close menu items using the toggle method.</ComponentDescription>
    </Component>
  </Column>
</Row>

## Delay on Hover

To prevent accidental opening or closing of Menu items, the component applies a default delay of 100 milliseconds before performing the action. You can customize this delay using the [`hoverDelay`](https://www.telerik.com/kendo-angular-ui/components/menus/api/menucomponent#hoverdelay) property.

```html
<kendo-menu [items]="items" [hoverDelay]="220"></kendo-menu>
```

The following example demonstrates how to configure the hover delay:

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/delay/source.txt)

## Opening on Click

By default, Menu items open on hover. To change this behavior and open items on click instead, set the [`openOnClick`](https://www.telerik.com/kendo-angular-ui/components/menus/api/menucomponent#openonclick) property to `true`.

```html
<kendo-menu [items]="items" [openOnClick]="true"></kendo-menu>
```

The following example demonstrates how to open Menu items on click.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/open-close/select/source.txt)

When `openOnClick` is set to `true` the user must click to open a Menu item. After an item is opened, all subsequent items open on hover until one is selected. You can further customize this behavior by specifying how items open and close by setting the [`openOnClick`](https://www.telerik.com/kendo-angular-ui/components/menus/api/menucomponent#openonclick) property to an [`OpenOnClickSettings`](https://www.telerik.com/kendo-angular-ui/components/menus/api/openonclicksettings) object.

```html
<kendo-menu [items]="items" [openOnClick]="{ toggle: 'click' }"></kendo-menu>
```

The `toggle` option allows you to control the opening behavior:

* `"click"`—Items open on hover but do not close when the mouse pointer leaves the Menu. To close the items, the user must click outside the Menu.
* `"leave"`—Items open on hover until either an item is selected, or the mouse pointer leaves the Menu and the predefined delay passes.

The following example demonstrates the behavior when `toggle` is set to `"leave"` or `"click"`.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/open-close/leave-click/source.txt)

## Toggling Menu Item Manually

You can open or close Menu items programmatically by using the [`toggle`](https://www.telerik.com/kendo-angular-ui/components/menus/api/menucomponent#toggle) method. This method accepts a boolean value which indicates if the items will be opened or closed and one or more string values which represent the hierarchical indices of the items that will be opened or closed.

```ts
public open(): void {
  this.menuRef.toggle(true, '0', '0_1');
}
```

The following example demonstrates how to toggle Menu items programmatically.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/menus/open-close/manual/source.txt)

## Suggested Links

* [API Reference of the Menu](https://www.telerik.com/kendo-angular-ui/components/menus/api)
