#How can I create a context menu coming out of a material sidenav ? I want the context menu to appear

1 messages · Page 1 of 1 (latest)

obtuse swallow
#

Haven't tried it, but I would create the menu element (the one that appears when clicking) inside the Organization element.

Set Organization element to position relative
Set menu element to position absolute
Then position the menu to be to the right by adding left: 100%

then with some simple JS to toggle a class on the menu element, so you can make it appear when clicking on the organization element.

pale coyote
fast aspen
#

@obtuse swallow for some reason it's opening above the trigger

#
<a
  mat-button
  fxLayout="row"
  fxLayoutAlign="start center"
  routerLinkActive="active"
  [matMenuTriggerFor]="user"
>
trigger
</a>```
#

@pale coyote any idea what I'm missing here ?

obtuse swallow
pale coyote
fast aspen
#

<mat-menu class="menu-panel" #menu2="matMenu"> asdasd</mat-menu>

pale coyote
#

and css for "menu-panel"?

fast aspen
#
  /* considerring 300px is your sidenav width */
  transform: translateX(300px);
}
#

also tried with margin-left

#

wait it's not even the same name 🤦‍♂️

pale coyote
#

check your class name

fast aspen
#

still the same unfortunatley

#

.menuPanel {
/* considerring 300px is your sidenav width */
transform: translateX(20rem);
}

#

<mat-menu class="menuPanel" #menu2="matMenu"> asdasd</mat-menu>

pale coyote
#

menuPanel should be in your global css, like styles.css, not in component's style.