material-web/demos/icon-toggle.html
2018-05-07 13:17:46 -07:00

64 lines
2.2 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>icon-toggle 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-icon-toggle/mwc-icon-toggle.js"></script>
<script type="module" src="../node_modules/@material/mwc-icon/mwc-icon.js"></script>
<link rel="stylesheet" href="demo-component.css">
<style>
.color {
--mdc-theme-text-primary-on-light: tomato;
}
</style>
</head>
<body class="unresolved">
<header>
<a href="index.html"><mwc-icon>arrow_back</mwc-icon>
<span>Icon Toggle</span></a>
</header>
<main>
<mwc-icon-toggle icon="sentiment_very_satisfied" offIcon="sentiment_very_dissatisfied"></mwc-icon-toggle>
<mwc-icon-toggle icon="sentiment_satisfied" offIcon="sentiment_neutral"></mwc-icon-toggle>
<h3>disabled</h3>
<mwc-icon-toggle disabled icon="sentiment_very_satisfied" offIcon="sentiment_very_dissatisfied"></mwc-icon-toggle>
<br><br>
<h4>color</h4>
<div class="color">
<mwc-icon-toggle icon="all_out" offIcon="accessibility"></mwc-icon-toggle>
<mwc-icon-toggle icon="exit_to_app" offIcon="camera"></mwc-icon-toggle>
</div>
</main>
<script type="module">
Array.from(document.querySelectorAll('mwc-icon-toggle')).forEach((e) => {
e.addEventListener('MDCIconToggle:change', (e) => console.log(e.type, e.target));
});
addEventListener('load', () => document.body.classList.remove('unresolved'));
</script>
</body>
</html>