cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv


A Pen By Captain Anonymous

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

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.

              <h1>xūs todos demo</h1>

<div id="main">
    <form onsubmit="add">
      <input type="text" id="input" />
      <input type="submit" value="Add task" />
    <p>You have completed <b>{completedCount}</b> of your tasks. Congratulations!</p>
    <p><b>Click on more tasks to finish them!</b><p>
      <li class="{#done}finished{/done}" onClick="toggle">{title}</li>
    <p><a href="https://github.com/tetsuo/xus/blob/master/examples/demo.html">source</a></p>
    <p><a href="https://tetsuo.github.io/xus/">xūs API homepage</a></p>
              const types = mobxStateTree.types

const Todo = types.model("Todo", {
  title: types.string,
  done: true
}, {
  toggle() {
    this.done = !this.done

const State = types.model("State", {
  todos: types.array(Todo),
  get completedCount() {
    return this.todos.reduce((count, todo) => (todo.done ? count + 1 : count), 0)
}, {
  add(event) {

    const currentTarget = event.currentTarget
    const input = currentTarget.querySelector("input[type=text]")

    if (!input.value.length) {

      title: input.value,
      done: false

    input.value = ""

const state = State.create({
  todos: [
    { title: "Get coffee", done: false },
    { title: "Wake up", done: true }

var targetElement = document.getElementById("main")

var options = {
  createElement: React.createElement,
  observer: mobxReact.observer

// ...aaand, action!
xus(targetElement.innerHTML, state, options, (er, newElement) => {
  if (er) throw er

  ReactDOM.render(newElement, targetElement)

Loading ..................