@polymer/iron-iconset-svg
Version:
Manages a set of svg icons
91 lines (80 loc) • 2.98 kB
HTML
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
<title>iron-iconset-svg</title>
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2.0.0/webcomponents-loader.js"></script>
<script type="module">
import '@polymer/iron-demo-helpers/demo-snippet.js';
import '@polymer/iron-demo-helpers/demo-pages-shared-styles.js';
import '@polymer/iron-icon/iron-icon.js';
import '../iron-iconset-svg.js';
import './svg-sample-icons.js';
import {html} from '@polymer/polymer/lib/utils/html-tag.js';
const template = html`
<custom-style>
<style is="custom-style" include="demo-pages-shared-styles"></style>
</custom-style>
`;
document.body.appendChild(template.content);
</script>
</head>
<body>
<div class="vertical-section-container centered">
<h3>
Import a document with an <code><iron-iconset-svg></code> to use the
icons it contains with <code><iron-icon></code> elements in your page.
</h3>
<demo-snippet>
<template>
<!-- Import your module with an <iron-iconset-svg>:
<script type="module" src="./svg-sample-icons.js"></script>
-->
<custom-style>
<style is="custom-style">
iron-icon {
height: 64px;
width: 64px;
margin: 1em;
fill: black;
}
iron-icon:hover {
fill: blue;
}
</style>
</custom-style>
<iron-icon icon="svg-sample-icons:codepen" role="img" aria-label="CodePen logo"></iron-icon>
<iron-icon icon="svg-sample-icons:twitter" role="img" aria-label="Twitter logo"></iron-icon>
<iron-icon icon="svg-sample-icons:youtube" role="img" aria-label="YouTube logo"></iron-icon>
</template>
</demo-snippet>
<h3>
Use an inline <code><iron-iconset-svg></code> if you need to both
define and use your icons in the same document.
</h3>
<demo-snippet>
<template>
<iron-iconset-svg name="inline" size="24">
<svg>
<defs>
<g id="shape">
<rect x="12" y="0" width="12" height="24"></rect>
<circle cx="12" cy="12" r="12"></circle>
</g>
</defs>
</svg>
</iron-iconset-svg>
<iron-icon icon="inline:shape" role="img" aria-label="A shape"></iron-icon>
</template>
</demo-snippet>
</div>
</body>
</html>