ion-menu
The Menu component is a navigation drawer that slides in from the side of the current view. By default, it slides in from the left, but the side can be overridden. The menu will be displayed differently based on the mode, however the display type can be changed to any of the available menu types. The menu element should be a sibling to the root content element. There can be any number of menus attached to the content. These can be controlled from the templates, or programmatically using the MenuController.
Basic Usage
Menu Toggle
The ion-menu-toggle component can be used to create custom button that can open or close the menu.
Menu Types
The type property can be used to customize how menus display in your application.
Theming
CSS Shadow Parts
Interfaces
MenuCustomEvent
While not required, this interface can be used in place of the CustomEvent interface for stronger typing with Ionic events emitted from this component.
interfaceMenuCustomEvent<T=any>extendsCustomEvent{
detail:T;
target: HTMLIonMenuElement;
}
Properties
contentId
id of the main content. When using a router this is typically ion-router-outlet. When not using a router, this is typically your main view's ion-content. This is not the id of the ion-content inside of your ion-menu.content-idstring | undefinedundefineddisabled
true, the menu is disabled.disabledbooleanfalsemaxEdgeStart
max-edge-startnumber50menuId
menu-idstring | undefinedundefinedside
side"end" | "start"'start'swipeGesture
true, swiping the menu is enabled.swipe-gesturebooleantruetype
"overlay", "reveal", "push".typestring | undefinedundefinedEvents
| Name | Description | Bubbles |
|---|---|---|
ionDidClose | Emitted when the menu is closed. | true |
ionDidOpen | Emitted when the menu is open. | true |
ionWillClose | Emitted when the menu is about to be closed. | true |
ionWillOpen | Emitted when the menu is about to be opened. | true |
Methods
close
false.close(animated?: boolean) => Promise<boolean>isActive
true is the menu is active.A menu is active when it can be opened or closed, meaning it's enabled and it's not part of a
ion-split-pane.isActive() => Promise<boolean>isOpen
true is the menu is open.isOpen() => Promise<boolean>open
false.open(animated?: boolean) => Promise<boolean>setOpen
false.setOpen(shouldOpen: boolean, animated?: boolean) => Promise<boolean>toggle
false.toggle(animated?: boolean) => Promise<boolean>CSS Shadow Parts
| Name | Description |
|---|---|
backdrop | The backdrop that appears over the main content when the menu is open. |
container | The container for the menu content. |
CSS Custom Properties
| Name | Description |
|---|---|
--background | Background of the menu |
--height | Height of the menu |
--max-height | Maximum height of the menu |
--max-width | Maximum width of the menu |
--min-height | Minimum height of the menu |
--min-width | Minimum width of the menu |
--width | Width of the menu |
Slots
No slots available for this component.