[フレーム]
Skip to main content
This is documentation for Ionic Documentation v6, which is no longer actively maintained.
For up-to-date documentation, see the latest version (v7).
Version: v6

ion-menu

shadow

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

The ion-menu-toggle component can be used to create custom button that can open or close the menu.

The type property can be used to customize how menus display in your application.

Theming

CSS Shadow Parts

Interfaces

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

Description The 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.
Attribute content-id
Type string | undefined
Default undefined

disabled

Description If true, the menu is disabled.
Attribute disabled
Type boolean
Default false

maxEdgeStart

Description The edge threshold for dragging the menu open. If a drag/swipe happens over this value, the menu is not triggered.
Attribute max-edge-start
Type number
Default 50
Description An id for the menu.
Attribute menu-id
Type string | undefined
Default undefined

side

Description Which side of the view the menu should be placed.
Attribute side
Type "end" | "start"
Default 'start'

swipeGesture

Description If true, swiping the menu is enabled.
Attribute swipe-gesture
Type boolean
Default true

type

Description The display type of the menu. Available options: "overlay", "reveal", "push".
Attribute type
Type string | undefined
Default undefined

Events

NameDescriptionBubbles
ionDidCloseEmitted when the menu is closed.true
ionDidOpenEmitted when the menu is open.true
ionWillCloseEmitted when the menu is about to be closed.true
ionWillOpenEmitted when the menu is about to be opened.true

Methods

close

Description Closes the menu. If the menu is already closed or it can't be closed, it returns false.
Signature close(animated?: boolean) => Promise<boolean>

isActive

Description Returns 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.
Signature isActive() => Promise<boolean>

isOpen

Description Returns true is the menu is open.
Signature isOpen() => Promise<boolean>

open

Description Opens the menu. If the menu is already open or it can't be opened, it returns false.
Signature open(animated?: boolean) => Promise<boolean>

setOpen

Description Opens or closes the button. If the operation can't be completed successfully, it returns false.
Signature setOpen(shouldOpen: boolean, animated?: boolean) => Promise<boolean>

toggle

Description Toggles the menu. If the menu is already open, it will try to close, otherwise it will try to open it. If the operation can't be completed successfully, it returns false.
Signature toggle(animated?: boolean) => Promise<boolean>

CSS Shadow Parts

NameDescription
backdropThe backdrop that appears over the main content when the menu is open.
containerThe container for the menu content.

CSS Custom Properties

NameDescription
--backgroundBackground of the menu
--heightHeight of the menu
--max-heightMaximum height of the menu
--max-widthMaximum width of the menu
--min-heightMinimum height of the menu
--min-widthMinimum width of the menu
--widthWidth of the menu

Slots

No slots available for this component.

AltStyle によって変換されたページ (->オリジナル) /