GithubHelp home page GithubHelp logo

derdrodt / moleculejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from molecule-js/moleculejs

0.0 1.0 0.0 1.25 MB

A library for creating fast and reactive Custom Elements

Home Page: https://moleculejs.org

License: Apache License 2.0

JavaScript 6.32% TypeScript 93.68%

moleculejs's Introduction

Molecule · GitHub license codecov npm version Build Status Greenkeeper badge Codacy Badge

Overview

Molecule is a JavaScript library for building user interfaces using web components.

It provides several classes from which you can build your Custom Elements

  • The Molecule base class. It is agnostic about your actual templatization and rendering function.
  • MoleculeLit class which uses the standard functions from lit-html by the Polymer team.
  • MoleculeLitExtended uses the extended rendering functions of lit-html.

Installation

The @moleculejs/molecule package can be installed using npm or yarn:

npm install --save @moleculejs/molecule
yarn add @moleculejs/molecule

Documentation

See the full documentation at MoleculeJS.org.

Examples

Let's start with a simple Example:

class HelloWorld extends MoleculeLit.Element {
  static get properties() {
    return {
      name: { type: String, attribute: true, value: 'John Doe' },
    };
  }
  render({ name }) {
    html`
      <div>Hello ${name}</div>
    `;
  }
}

customElements.define('hello-world', HelloWorld);

This creates a new Custom Element called hello-world, which can now be used anywhere in your application using <hello-world>.

This new element will also keep the property name in sync with the attribute name, meaning that the element will look like this in the DOM:

<hello-world name="John Doe"></hello-world>

If you change the attribute or the property, both will be kept in sync and the element will be rerendered.

Contributing

Coming soon!

moleculejs's People

Contributors

codacy-badger avatar derdrodt avatar greenkeeper[bot] avatar tjfwalker avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.