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
17
votes
1 answer

Polymer and WebComponentsReady event

According to the Polymer docs, the WebComponentsReady event is necessary because... The polyfills parse element definitions and handle their upgrade asynchronously. If you prematurely fetch the element from the DOM before it has a chance to…
bitpshr
  • 1,033
  • 2
  • 9
  • 21
16
votes
2 answers

Polymer Starter Kit vs Polymer App Toolbox

What's the difference between Polymer Starter Kit and Polymer App Toolbox? Both are collections of web components, build & testing tools, and Material Design templates for building Progressive Web Apps with Polymer. Which one should I base my new…
16
votes
3 answers

Polymer 1.x: Modal paper-dialog appears behind its backdrop

Does anybody have any advice for fixing the problem of a modal appearing behind its backdrop? So far, I have tried making sure I have all the necessary imports (including ). I also tried a "hack-fix" (suggested by someone)…
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
16
votes
2 answers

Are there any built in auto-complete input components for Polymer 1.0?

I've been muddling around with Polymer 1.0 since its release, and I've hit a use case where a select list just won't be sufficient (too many options to select from). What I really need is an autocomplete textbox. Is there one built-in or planned in…
Ryan Nigro
  • 4,389
  • 2
  • 17
  • 23
16
votes
2 answers

Polymer Chip-to-Card Pattern with core-animated-pages and a Long List

Generally I'm finding it difficult to use the core-animated-pages Polymer element to implement a chip list to card type pattern when I have a very long list that scrolls the page. I think the difficulty is that once the transition has finished, the…
Shaun
  • 1,485
  • 2
  • 15
  • 21
16
votes
2 answers

document.querySelector() returns null

I'm creating a polymer element. I've made the template and am now working on the script. For some reason document.querySelector is returning null for both class and id selectors. Not sure if this doesn't work with polymer (no reason it shouldn't) or…
user3903150
  • 161
  • 1
  • 1
  • 4
16
votes
2 answers

Why does Angular not need a dash in component name

I wondered why Polymer elements need a dash in custom elements name like while this is not necessary for Angular components especially as Angular components also use ShadowDOM. ** Edit** It doesn't even seem to be suggested good…
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
15
votes
1 answer

Polymer back button doesn't work with hash routing

Sup! Back button sometimes doesn't work with my polymer project. When i hit back button the page variable is steel the current page and i need to hit the button twice or three times to get it working for example i go to the /#/rules page from…
user3677687
15
votes
1 answer

Debouncer in Polymer 2.0

Simple question, but no documentation is to be found on the subject : is there a debouncer in Polymer 2.0? If so, how can it be used? this.debounce was an instance method in 1.0, but it appears to have disappeared. Thanks in advance!
CedricLaberge
  • 592
  • 2
  • 7
  • 22
15
votes
2 answers

Double Brackets [[ ]] vs Double Braces {{ }} in Polymer

What's a succinct way to explain the difference between double brackets ([[...]]) and double braces ({{...}}) in Polymer 1.0? For instance, in the documentation for the element the sample HTML shows: