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
20
votes
2 answers

Using querySelector to find nested elements inside a Polymer template returns null

I'm trying to use paper-tabs inside new element (tabs-list) but after print tabs I can't use querySelector to change selected one. Element code (without style):
Albert Hornos
  • 215
  • 1
  • 2
  • 7
20
votes
3 answers

How do I pass arbitrary data to a click event handler function from a Dart polymer web component

In Dart's Web UI, it was possible to pass arbitrary data to function in response to events, for example, the following snippet passes the value 2 to the increment(int incBy) method in response to the button's on-click event:
Chris Buckett
  • 13,738
  • 5
  • 39
  • 46
19
votes
4 answers

Where should I place my Vaadin 10+ static files?

In Vaadin 10-14, where should I place my static files, such as CSS, JavaScript, and Polymer templates? How about static files such as images? Also, how do I import these files in Vaadin? Is there a difference between Vaadin 14 with npm and Vaadin…
Erik Lumme
  • 5,202
  • 13
  • 27
19
votes
3 answers

Polymer Dom-Repeat Binding to Content

In polymer 1.2.3, Is it possible for a dom-repeat to use content as a template and bind values to the elements provided? Custom Element: