
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
[](http://regularjs.github.io)
Regularjs is a living template engine that helps us to create data-driven components.
var Note = Regular.extend({
template:
"<input {#if !disabled} r-model='hello' {#else} disabled {/if} > {hello} \
<button on-click={disabled = !disabled}>{disabled? 'active': 'disable'} it</button>"
});
// inject component into #app , you can also inject at 'before' , 'after', 'top'.
var note = new Note().$inject("#app");
This example is dead simple, but you can find the directive and attribute is easily switched by statement 'if', which is difficult with other mvvm frameworks.
var NoteList = Regular.extend({
template:
"<ul>{#list notes as nt}" +
"<li class={nt.done? 'done': ''} on-click={nt.done= !nt.done}>{{nt.content}}</li>" +
"{/list}</ul>"
});
var list = new NoteList({
data: {
notes: [
{content: 'playgame'},
{content: 'homework'}
]
}
}).$inject("#app");
In this Example, we create a ListView with the statement list.
We need to refactor Note to make it composable.
var Note = Regular.extend({
name: 'note', // register component during the definition of Component
template:
"<input r-model={draft}> <button on-click={this.post()}> post</button>",
post: function(){
var data = this.data;
this.$emit('post', data.draft);
data.draft = ""; //clear the draft
}
});
Regular.component('list', NoteList); // manual register a component
When 'Enter' is pressed, Note will emit a 'post' event with draft as the $event object.
The keyword
thisin the template refers to the component itself.
Then, let's define the core component: NoteApp.
var NoteApp = Regular.extend({
template:
"<note on-post={notes.push({ content: $event} )}/>"+
"<list notes ={notes}></list>"
});
var noteapp = new NoteApp({
data: {notes:[]}
});
noteapp.$inject('#app');
you can register a component (via attribute name or method Component.component) to make it composable in other components.
See more on Guide: Quick Start
IE7+ and other modern browsers.
bower install regularjs
dist/regular.js has been packaged as a standard UMD, and therefore you can use it in AMD, commonjs or global.
$ npm install regularjs
use
var Regular = require('regularjs');
$ component install regularjs/regular
use
var Regular = require('regularjs/regular');
If you find any bug or have any suggestion, please feel free to open an issue
Ask any question on Stack Overflow with tag regularjs.
Social

regularjs is still under heavy development, and please help us with feedback. Contributing to this project is also welcome.
test/specs folder. Always make sure the gulp test is passed, and the test/runner/index.html is passed in every target browser (if a certain browser is not installed, list that in gulpfile's karmaConfig)MIT.
remove log code in production mode;
FAQs
[](http://regularjs.github.io)
The npm package regularjs receives a total of 92 weekly downloads. As such, regularjs popularity was classified as not popular.
We found that regularjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.