Questions tagged [polymer]

The Polymer library provides a set of features that make it easy and fast to make custom elements that work like standard DOM elements.

Polymer is an open source project led by the Google team. Its purpose is to implement the set of W3C specifications dealing with web components into an open source library and architecture suitable for creating and enabling reusable widgets (called web components) in modern web applications.


Example code

Simple Example:

<link rel="import" href="bower_components/polymer/polymer.html">

<dom-module id="my-tag">

  <template>
    <style>
      /* CSS rules for your element */
    </style>
    <!-- local DOM for your element -->
    <p>This is my custom Tag</p>
  </template>

  <script>
    // element registration
    Polymer({
      is: 'my-tag'
    });
  </script>
</dom-module>

Using it in another document:

<!-- Add the <link> tag in the head of your markup -->
<link rel="import" href="bower_components/my-tag/my-tag.html">

<!-- Use your new tag anywhere in the document, which
     as you expect results in "This is my custom Tag" -->
<my-tag></my-tag>

Useful resources:

8272 questions
2
votes
1 answer

Uncaught ReferenceError drawer is not defined at HTMLElement.onclick in Polymer 2.0?

Im pretty new to polymer 2.0 and am trying to get my head around certain errors i dont seem to understand. One of them being this: Uncaught ReferenceError: drawer is not defined at HTMLElement.onclick So to explain my problem, I am trying to use…
James
  • 267
  • 3
  • 5
  • 14
2
votes
1 answer

Can't understand Polymer 2.0 custom element properties?

class DemoElement extends Polymer.Element { static get is() { return "demo-element" } static get properties() { return { prop1 : { type:String, notify: true, reflectToAttriubute: true, } } } } I…
Prajeet Shrestha
  • 7,978
  • 3
  • 34
  • 63
2
votes
1 answer

Polymer 2 styling an element's child node from an outside stylesheet

Let's say that I have a custom web element called with its own style defined in the