mirror of
https://github.com/material-components/material-web.git
synced 2024-10-27 14:07:17 +03:00
85 lines
2.9 KiB
HTML
85 lines
2.9 KiB
HTML
<!doctype html>
|
|
<!--
|
|
@license
|
|
Copyright 2018 Google Inc. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<html>
|
|
<head>
|
|
<title>menu demo</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
|
|
<script type="module" src="../node_modules/@material/mwc-button/mwc-button.js"></script>
|
|
<script type="module" src="../node_modules/@material/mwc-menu/mwc-menu.js"></script>
|
|
<script type="module" src="../node_modules/@material/mwc-list/mwc-list-item.js"></script>
|
|
<script type="module" src="../node_modules/@material/mwc-list/mwc-list-item-separator.js"></script>
|
|
<script type="module" src="../node_modules/@material/mwc-icon/mwc-icon.js"></script>
|
|
<link rel="stylesheet" href="demo-component.css">
|
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">
|
|
|
|
<style>
|
|
body {
|
|
min-height: calc(100vh - 4em);
|
|
}
|
|
|
|
.demo-mdc-menu-anchor {
|
|
display: inline-block;
|
|
position: relative;
|
|
overflow: visible;
|
|
}
|
|
|
|
.demo-log {
|
|
margin: 8px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="unresolved">
|
|
<header>
|
|
<a href="index.html"><mwc-icon>arrow_back</mwc-icon>
|
|
<span>Menu</span></a>
|
|
</header>
|
|
|
|
<main>
|
|
|
|
<div class="demo-mdc-menu-anchor">
|
|
<mwc-button id="button" raised ripple label="Go"></mwc-button>
|
|
<mwc-menu id="menu">
|
|
<mwc-list-item label="one"></mwc-list-item>
|
|
<mwc-list-item label="two"></mwc-list-item>
|
|
<mwc-list-item label="three"></mwc-list-item>
|
|
<mwc-list-item disabled label="four"></mwc-list-item>
|
|
<mwc-list-item-separator></mwc-list-item-separator>
|
|
<mwc-list-item label="aaa"></mwc-list-item>
|
|
<mwc-list-item label="bbb"></mwc-list-item>
|
|
</mwc-menu>
|
|
</div>
|
|
<div class="demo-log" id="log"></div>
|
|
</main>
|
|
<script>
|
|
button.addEventListener('click', function (e) {
|
|
menu.setAnchorCorner(menu.Corner.BOTTOM_START);
|
|
menu.open = !menu.open;
|
|
})
|
|
|
|
menu.addEventListener('MDCMenu:selected', function(evt) {
|
|
var detail = evt.detail;
|
|
log.textContent = `selected: ${detail.index}, ${detail.item.label}`;
|
|
});
|
|
|
|
addEventListener('load', function() { document.body.classList.remove('unresolved'); });
|
|
</script>
|
|
</body>
|
|
</html>
|