Menu Surface
Menu Surfaces (`mdcMenuSurface`) are reusable surfaces that appear above the content of the page when in view. They can be positioned adjacent to an element that triggers the activation (e.g. the provided `mdcMenuAnchor` directive).
Menu Surfaces are used by mdcMenu, and mdcSelectMenu. But they can also be used on their own.
API
Directive: MdcMenuSurfaceDirective
Selector: [mdcMenuSurface] [mdcMenu] [mdcSelectMenu]
The mdcMenuSurface
is a reusable surface that appears above the content of the page
and can be positioned adjacent to an element. It is required as the surface for an mdcMenu
but can also be used by itself.
Property | Description |
---|---|
@Input()
menuAnchor
MdcMenuAnchorDirective | Element | null
|
Assign an (optional) element or |
@Input()
viewport
HTMLElement | null
|
Assign any You should probably not use this property. We only use it to keep the documentation snippets on our demo website contained in their window. |
@Output()
openChange
EventEmitter<boolean>
|
Event emitted when the menu is opened or closed. (When this event is triggered, the surface is starting to open/close, but the animation may not have fully completed yet). |
@Output()
afterOpened
EventEmitter<void>
|
Event emitted after the menu has fully opened. When this event is emitted the full opening animation has completed, and the menu is visible. |
@Output()
afterClosed
EventEmitter<void>
|
Event emitted after the menu has fully closed. When this event is emitted the full closing animation has completed, and the menu is not visible anymore. |
@Input()
open
boolean
|
When this input is defined and does not have value false, the menu will be opened, otherwise the menu will be closed. |
@Input()
openFrom
'tl' | 'tr' | 'bl' | 'br' | 'ts' | 'te' | 'bs' | 'be'
|
Set this value if you want to customize the direction from which the menu will be opened.
Use |
@Input()
hoisted
boolean
|
Set to a value other then false to hoist the menu surface to the body so that the position offsets
are calculated relative to the page and not the anchor. (When a |
@Input()
fixed
boolean
|
Set to a value other then false use fixed positioning, so that the menu stays in the same place on the window (or viewport) even if the page (or viewport) is scrolled. |
Directive: MdcMenuAnchorDirective
Selector: [mdcMenuAnchor]
Defines an anchor to position an mdcMenuSurface
to. If this directive is used as the direct parent of an mdcMenuSurface
,
it will automatically be used as the anchor point. (Unless de mdcMenuSurface
sets another anchor via its menuAnchor
property).