OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --><!-- |
| 10 @group Paper Elements |
| 11 |
| 12 Material Design: <a href="http://www.google.com/design/spec/components/buttons.h
tml">Button</a> |
| 13 |
| 14 `paper-fab` is a floating action button. It contains an image placed in the cent
er and |
| 15 comes in two sizes: regular size and a smaller size by applying the attribute `m
ini`. When |
| 16 the user touches the button, a ripple effect emanates from the center of the but
ton. |
| 17 |
| 18 You may import `iron-icons` to use with this element, or provide a URL to a cust
om icon. |
| 19 See `iron-iconset` for more information about how to use a custom icon set. |
| 20 |
| 21 Example: |
| 22 |
| 23 <link href="path/to/iron-icons/iron-icons.html" rel="import"> |
| 24 |
| 25 <paper-fab icon="add"></paper-fab> |
| 26 <paper-fab mini icon="favorite"></paper-fab> |
| 27 <paper-fab src="star.png"></paper-fab> |
| 28 |
| 29 Styling |
| 30 ------- |
| 31 |
| 32 Style the button with CSS as you would a normal DOM element. If you are using th
e icons |
| 33 provided by `iron-icons`, the icon will inherit the foreground color of the butt
on. |
| 34 |
| 35 /* make a blue "cloud" button */ |
| 36 <paper-fab icon="cloud" style="color: blue;"></paper-fab> |
| 37 |
| 38 By default, the ripple is the same color as the foreground at 25% opacity. You m
ay |
| 39 customize the color using this selector: |
| 40 |
| 41 /* make #my-button use a blue ripple instead of foreground color */ |
| 42 #my-button::shadow #ripple { |
| 43 color: blue; |
| 44 } |
| 45 |
| 46 The opacity of the ripple is not customizable via CSS. |
| 47 |
| 48 @element paper-fab |
| 49 @status unstable |
| 50 --><html><head><link rel="import" href="../polymer/polymer.html"> |
| 51 <link rel="import" href="../iron-icon/iron-icon.html"> |
| 52 <link rel="import" href="../iron-flex-layout/classes/iron-flex-layout.html"> |
| 53 <link rel="import" href="../paper-styles/default-theme.html"> |
| 54 <link rel="import" href="../paper-material/paper-material.html"> |
| 55 <link rel="import" href="../paper-ripple/paper-ripple.html"> |
| 56 <link rel="import" href="../paper-behaviors/paper-button-behavior.html"> |
| 57 |
| 58 <style is="x-style"> |
| 59 * { |
| 60 --paper-fab-disabled-text: #c9c9c9; |
| 61 --paper-fab-disabled-background: var(--accent-color); |
| 62 } |
| 63 </style> |
| 64 |
| 65 </head><body><dom-module id="paper-fab"> |
| 66 <style> |
| 67 |
| 68 :host { |
| 69 display: inline-block; |
| 70 position: relative; |
| 71 outline: none; |
| 72 -moz-user-select: none; |
| 73 -ms-user-select: none; |
| 74 -webkit-user-select: none; |
| 75 user-select: none; |
| 76 cursor: pointer; |
| 77 |
| 78 box-sizing: border-box; |
| 79 min-width: 0; |
| 80 width: 56px; |
| 81 height: 56px; |
| 82 background: var(--accent-color); |
| 83 color: var(--text-primary-color); |
| 84 border-radius: 50%; |
| 85 padding: 16px; |
| 86 |
| 87 z-index: 0; |
| 88 |
| 89 mixin(--paper-fab); |
| 90 } |
| 91 |
| 92 :host([mini]) { |
| 93 width: 40px; |
| 94 height: 40px; |
| 95 padding: 8px; |
| 96 |
| 97 mixin(--paper-fab-mini); |
| 98 } |
| 99 |
| 100 :host([disabled]) { |
| 101 color: var(--paper-fab-disabled-text); |
| 102 |
| 103 mixin(--paper-fab-disabled); |
| 104 } |
| 105 |
| 106 paper-material { |
| 107 border-radius: inherit; |
| 108 } |
| 109 </style> |
| 110 <template> |
| 111 <paper-ripple></paper-ripple> |
| 112 <paper-material class="content fit flex layout vertical center-center" eleva
tion="[[elevation]]" animated=""> |
| 113 <iron-icon id="icon" src="[[src]]" icon="[[icon]]"></iron-icon> |
| 114 </paper-material> |
| 115 </template> |
| 116 </dom-module> |
| 117 <script src="paper-fab-extracted.js"></script></body></html> |
OLD | NEW |