Let Me Tink About It
Let Me Tink About It

Reputation: 16112

Polymer 1.x: Help getting this JSBin to render <paper-header-panel> and <paper-toolbar>

http://jsbin.com/mefonoqanu/1/edit?html,output

This JSBin doesn't render its contents. It does not display:

What am I doing wrong? Please provide a working JSBin example.

Note: Per this link, <paper-header-panel> requires host to have a height.

Code

<!DOCTYPE html>
<html>  
<head>
  <meta charset="utf-8">
  <title>Polymer Bin</title>
  <base href="http://element-party.xyz/">
  <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  <link rel="import" href="all-elements.html">
</head>
<body class="fullbleed layout vertical">
<x-element></x-element>
<dom-module id="x-element">
  <template>
    <style>
    </style>
    <paper-header-panel class="flex">
      <paper-toolbar>Header</paper-toolbar>
      <div>Content goes here...</div>
    </paper-header-panel>   
  </template>
  <script>
    (function(){
      Polymer({
        is: 'x-element'
      });
    })();
  </script>
</dom-module>
</body>
</html>

Upvotes: 0

Views: 716

Answers (3)

Let Me Tink About It
Let Me Tink About It

Reputation: 16112

Here is the minimum markup necessary to answer the question:

http://jsbin.com/jocinasovo/edit?html,output

Changes

  1. Added style using :host
  2. Only need height not width
  3. No need to switch from bower_components (per this link) to rawgit CDN
  4. No need for .flex class on <paper-header-panel>

Note: Per this link, <paper-header-panel> requires host to have a height.

Code

<!DOCTYPE html>
<html>  
<head>
  <meta charset="utf-8">
  <title>Polymer Bin</title>
  <base href="http://element-party.xyz/">
  <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
  <link rel="import" href="all-elements.html">
</head>
<body class="fullbleed layout vertical">
<x-element></x-element>
  <dom-module id="x-element">
  <template>
    <style>
      :host {
        height: 100%
      }
    </style>
    <paper-header-panel>
      <paper-toolbar><span>Header</span></paper-toolbar>
      <div>Content goes here...</div>
    </paper-header-panel>   
  </template>
  <script>
    (function(){
      Polymer({
        is: 'x-element'
      });
    })();
  </script>
</dom-module>
</body>
</html>

Upvotes: 0

Let Me Tink About It
Let Me Tink About It

Reputation: 16112

Code of accepted answer

<!DOCTYPE html>
<html>  
<head>
  <meta charset="utf-8">
  <title>Polymer Bin</title>
  <script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents.js"></script>

  <base href="http://element-party.xyz/">
  <link rel="import" href="all-elements.html">

</head>
<body class="fullbleed layout vertical">
<x-element style="width:100%; height: 100%;"></x-element>
  <dom-module id="x-element">
  <template>
    <style>
    </style>
    <paper-header-panel class="flex">
      <paper-toolbar ><span class="title">Header</span></paper-toolbar>
      <div >
        Content goes here...<br>
      </div>
    </paper-header-panel>   
  </template>
  <script>
    (function(){
      Polymer({
        is: 'x-element'
      });
    })();
  </script>
</dom-module>
</html>

Upvotes: 0

user656449
user656449

Reputation: 3032

http://jsbin.com/kabede/5/edit?html,output

The changes:

  1. webcomponents from rawgit instead of bower_components
  2. <span class="title"> to make header visible
  3. style="width:100%; height: 100%;" on element to see its content

Upvotes: 1

Related Questions