JuanPablo
JuanPablo

Reputation: 843

Customize the style/class of a Material2 MdMenu

The documentation is a little sparse on how to modify a menu...either that or I'm just dense. How could I, for example, just change the backcolor of a menu to red?

Upvotes: 1

Views: 172

Answers (1)

Edric
Edric

Reputation: 26811

Simply use the class input on your md-menu:

app.component.html:

<button md-button [mdMenuTriggerFor]="moreMenu">Menu</button>
<md-menu #moreMenu="mdMenu" class="myMenu">
    <button md-menu-item>Item 1</button>
    <button md-menu-item>Item 2</button>
</md-menu>

styles.css (For some reason it doesn't work in styleUrls):

.myMenu {
    background-color: red;
}

Plunker demo

By the way, the thing you were looking for is this:

<code>@Input('class') classList</code>

Upvotes: 3

Related Questions