Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <base href="https://raw-dot-custom-elements.appspot.com/t2ym/i18n-number/2.0.2/i18n-number/">
<script src="../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-styles/demo-pages.html">
<link rel="import" href="../iron-demo-helpers/demo-snippet.html">
<link rel="import" href="../iron-demo-helpers/demo-pages-shared-styles.html">
<link rel="import" href="i18n-number.html">
<link rel="import" href="demo/nano-calc.html">

<custom-style>
  <style include="demo-pages-shared-styles">
    .vertical-section-container {
      max-width: 768px;
    }
    @media (max-width: 640px) {
      body {
        font-size: 14px;
        margin: 0;
        padding: 4px;
        background-color: var(--paper-grey-50);
      }
      .horizontal-section {
        background-color: white;
        padding: 8px;
        margin-right: 4px;
        min-width: 200px;
        @apply (--shadow-elevation-2dp);
      }
      .vertical-section {
        background-color: white;
        padding: 8px;
        margin: 0 4px 8px 4px;
        @apply (--shadow-elevation-2dp);
      }
    }
  </style>
</custom-style>
<custom-style>
  <style>
    --demo-snippet-code {
      @apply (--paper-font-code1);
    }
    
    paper-item {
      display: block;
    }
    code {
      font-family: 'Roboto Mono', 'Consolas', 'Menlo', monospace;
      color: black;
    }
    .input {
      font-family: 'Roboto', sans-serif;
      font-size: 16px;
      border-width: 0px;
      outline-width: 0px;
    }
    .select {
      font-family: 'Roboto', sans-serif;
      font-size: 16px;
      outline-width: 0px;
      border-width: 0px;
      background-color: rgba(255, 255, 255, 0.0);
    }
    option {
      position: relative;
      top: -1;
      color: black;
      outline-width: 0px;
      border-width: 0px;
    }
    .dropdown {
      --editable-dropdown-menu: {
        display: inline-block;
        margin-right: 8px;
        text-align: left;
        width: 180px;
      }
    }
    .demo-paper-dropdown-menu {
      font-family: 'Roboto', 'Noto', Helvetica, sans-serif;
      font-size: 16px;
      font-weight: 400;
      line-height: 24px;
      text-align: left;
      margin: auto;
      width: 180px;
    }
    @media (max-width: 640px) {
      body {
        font-size: 14px;
        margin: 0;
        padding: 4px;
        background-color: var(--paper-grey-50);
      }
      .horizontal-section {
        background-color: white;
        padding: 8px;
        margin-right: 4px;
        min-width: 200px;
        @apply (--shadow-elevation-2dp);
      }
      .vertical-section {
        background-color: white;
        padding: 8px;
        margin: 0 4px 8px 4px;
        @apply (--shadow-elevation-2dp);
      }
    }
  </style>
</custom-style>

<div class="vertical-section-container centered">

  <h1><code>&lt;i18n-number&gt;</code> Demo</h1>

  <div class="vertical-section-container">
    <h2>Number in English (en) locale</h2>
    <demo-snippet class="centered-demo">
      <template>
            <i18n-number lang="en">123456.78</i18n-number>
          </template>
      <script type="text/markdown">
        <i18n-number lang="en">123456.78</i18n-number>
      </script>
    </demo-snippet>

    <h2>Currency - USD in English (en) locale</h2>
    <demo-snippet class="centered-demo">
      <template>
            <i18n-number 
              lang="en"
              options='{ "style": "currency", "currency": "USD" }' 
              >123456.78</i18n-number>
          </template>
      <script type="text/markdown">
        <i18n-number lang="en" options='{ "style": "currency", "currency": "USD" }'>123456.78</i18n-number>
      </script>
    </demo-snippet>

    <!--
        <h2><code>&lt;i18n-number&gt;</code> with different parameters</h2>
        <demo-snippet id="demo-snippet" class="left-aligned-demo" _markdown="{{markdown}}">
          <template>
            <i18n-number-demo id="i18n-number-demo"></i18n-number-demo>
          </template>
        </demo-snippet>
        -->

    <h2>Digits display for <code>&lt;nano-calc&gt;</code></h2>
    <demo-snippet class="centered-demo">
      <template>
            <nano-calc x="123456.789"></nano-calc>
          </template>
      <script type="text/markdown">
        <dom-module id="nano-calc">
          <template>
                ...
                <span class="layout horizontal digits-display">
                  <span class="flex"></span>
                  <i18n-number id="value" 
                    formatted="{{value}}"
                    options='{ "maximumFractionDigits": 16 }'
                    >{{pickDisplayValue(x,y,op)}}</i18n-number>
                  </span>
                </span>
                ...
              </template> ...
        </dom-module>
      </script>
    </demo-snippet>

    <script>
      window.addEventListener("WebComponentsReady", function() {
        var demoSnippets = document.querySelectorAll("demo-snippet");
        Array.prototype.forEach.call(demoSnippets, function(demo) {
          var script = Polymer.dom(demo).queryDistributedElements(
            'script[type="text/markdown"]'
          )[0];
          if (!script) {
            return;
          }
          var snippet = script.innerHTML;
          var match = snippet.match(/\n([ ]*)/);
          if (match && match[1]) {
            var lines = snippet.split(/\n/);
            snippet = lines
              .map(function(line) {
                if (line.indexOf(match[1]) === 0) {
                  line = line.slice(match[1].length);
                }
                return line;
              })
              .join("\n");
          }
          snippet = "```\n" + snippet + "\n```";
          snippet = snippet.replace(/=""/g, "");
          demo._markdown = snippet;
        });
      });
      var demoSnippet = document.querySelector("demo-snippet#demo-snippet");
      demoSnippet.addEventListener("markdown-changed", function(e) {
        demoSnippet._markdown = e.detail.markdown;
      });
    </script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console