Our original Web Component library.
Go to file
2016-02-23 16:35:37 -08:00
.github [ci skip] Add instructions to pull request template 2016-02-22 11:14:32 -08:00
explainer fix crlf once and for all 2016-02-17 16:03:34 -08:00
src Make sure to configure properties on polymer elements that do not have property effects. 2016-02-19 14:34:50 -08:00
test Make sure to configure properties on polymer elements that do not have property effects. 2016-02-19 14:34:50 -08:00
.eslintignore Lint the tests 2016-02-12 12:25:01 -08:00
.eslintrc.json Update to gulp-eslint v2 2016-02-16 10:30:20 -08:00
.gitattributes fix crlf once and for all 2016-02-17 16:03:34 -08:00
.gitignore Refactor build process 2015-05-25 14:30:59 -07:00
.travis.yml [ci skip] move linting into before_script stage 2016-02-11 12:38:48 -08:00
bower.json [ci skip] prepare v1.3.0 2016-02-22 11:34:26 -08:00
CHANGELOG.md [ci skip] Update Changelog 2016-02-22 11:36:15 -08:00
CONTRIBUTING.md [ci skip] Use https for jsbin 2016-02-17 11:45:28 -08:00
gen-changelog.sh Update Changelog 2015-08-20 11:47:26 -07:00
gulpfile.js Update to gulp-eslint v2 2016-02-16 10:30:20 -08:00
index.html Update index.html 2015-07-13 14:44:49 +08:00
LICENSE.txt Add audit task 2015-05-14 11:30:46 -07:00
package.json [ci skip] prepare v1.3.0 2016-02-22 11:34:26 -08:00
polymer-micro.html Fixes #3108. Moves debounce functionality from polymer-micro to polymer-mini. The functionality belongs at the mini tier and was never actually functional in micro. 2015-11-30 14:29:34 -08:00
polymer-mini.html fix crlf once and for all 2016-02-17 16:03:34 -08:00
polymer.html fix crlf once and for all 2016-02-17 16:03:34 -08:00
PRIMER.md Update PRIMER.md 2015-12-17 15:32:32 +01:00
README.md Updated the README.md for a non-technical user to understand 2016-02-18 12:58:17 -05:00
wct.conf.json Fix the config 2015-04-30 23:22:23 -07:00

Polymer

Build Status

Polymer lets you build encapsulated, re-usable elements that work just like HTML elements, to use in building web applications.

Polymer is a library built on top of Web Component, that makes it easier to build your very own custom HTML elements, which can be reused for any project. It makes building complex web applications easier and more efficient. Imagine you have a specific navigation bar or a hamburger menu that you like to create and use in all of your projects. Instead of building that navigation bar or menu for every project, you can utilize Polymer to easily create that element one time and then reuse it throughout your project or any project of your choosing.

Polymer provides a declarative syntax (defining what needs to be done and letting the computer figure out how to do it), to easily create your own custom elements. It allows one to easily develop the structure of the element with HTML, style it with CSS, and add interactions with the element utilizing JavaScript. It also provides two-way data-binding meaning:

  1. When properties in the model gets updated, so does the user interface.
  2. When the elements on the user interface get updated, the changes are propagated back to the model.

If you dont want to build your own custom elements Polymer comes with a collection of pre-built elements that you can just drop on a page and use immediately. You can even use Polymer's collection of elements as a starting point for you own elements. Just include it in a project, expand upon it customizing the element to your liking, thus creating your own custom element.

<!-- Polyfill Web Components for older browsers -->
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>

<!-- Import element -->
<link rel="import" href="google-map.html">

<!-- Use element -->
<google-map latitude="37.790" longitude="-122.390"></google-map>

Getting Started

Check out polymer-project.org for all of the library documentation, including getting started guides, tutorials, developer reference, and more.

Or if you'd just like to download the library, check out our releases page.

Polymer in 1 Minute

The Polymer library is a lightweight sugaring layer on top of the web components API's to help in building your own web components. It adds convenient features to make it easy to build complex elements:

Create and register a custom element

/**
 * A not-very-useful inline element
 */
Polymer({
    is: 'my-element'
});
<!-- use the element -->
<my-element></my-element>

Add markup to your element

<!-- define the markup that your element will use -->
<dom-module id="my-simple-namecard">
  <template>
    <div>
      Hi! My name is <span>Jane</span>
    </div>
  </template>

  <script>
    Polymer({
        is: 'my-simple-namecard'
    });
  </script>
</dom-module>

Configure properties on your element...

// Create an element that takes a property
Polymer({
    is: 'my-property-namecard',
    properties: {
      myName: {
        type: String
      }
    },
    ready: function() {
      this.textContent = 'Hi! My name is ' + this.myName;
    }
});

...and have them set using declarative attributes

<!-- using the element -->
<my-property-namecard my-name="Jim"></my-property-namecard>

Hi! My name is Jim

Bind data into your element using the familiar mustache-syntax

<!-- define markup with bindings -->
<dom-module id="my-bound-namecard">
  <template>
    <div>
      Hi! My name is <span>{{myName}}</span>
    </div>
  </template>

  <script>
    Polymer({
      is: 'my-bound-namecard',
      properties: {
        myName: {
          type: String
        }
      }
    });
  </script>
</dom-module>
<!-- using the element -->
<my-bound-namecard my-name="Josh"></my-bound-namecard>

Hi! My name is Josh

Style the internals of your element, without the style leaking out

<!-- add style to your element -->
<dom-module id="my-styled-namecard">
  <template>
    <style>
      /* This would be crazy in non webcomponents. */
      span {
        font-weight: bold;
      }
    </style>

    <div>
      Hi! My name is <span>{{myName}}</span>
    </div>
  </template>

  <script>
    Polymer({
      is: 'my-styled-namecard',
      properties: {
        myName: {
          type: String
        }
      }
    });
  </script>
</dom-module>
<!-- using the element -->
<my-styled-namecard my-name="Jesse"></my-styled-namecard>

Hi! My name is Jesse

and so much more!

Web components are an incredibly powerful new set of primitives baked into the web platform, and open up a whole new world of possibility when it comes to componentizing front-end code and easily creating powerful, immersive, app-like experiences on the web.

By being based on Web Components, elements built with Polymer are:

  • Built from the platform up
  • Self-contained
  • Don't require an overarching framework - are interoperable across frameworks
  • Re-usable

Contributing

The Polymer team loves contributions from the community! Take a look at our contributing guide for more information on how to contribute.

Communicating with the Polymer team

Beyond Github, we try to have a variety of different lines of communication available:

License

The Polymer library uses a BSD-like license available here