css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <section id="todoapp">
  <header id="header">
    <input id="new-todo" data-bind="enter: saveTodo, value: newTodo" placeholder="What needs to be done?" autofocus>
  <section id="main" data-bind="attr: { class : isVisible }">
    <input id="toggle-all" type="checkbox" data-bind="events: { click: toggleAll }, checked: allCompleted">
    <label for="toggle-all">Mark all as complete</label>
    <ul id="todo-list" data-template="item-template" data-bind="source: todos"></ul>
  <footer id="footer" class="hidden" data-bind="attr: { class: isVisible }">
    <span id="todo-count">
      <strong data-bind="text: activeCount"></strong>
      <span data-bind="text: activeCountText"></span> left
    <ul id="filters">
      <li><a href="#/" data-bind="attr: { class: allFilterClass }">All</a></li>
      <li><a href="#/active" data-bind="attr: { class: activeFilterClass }">Active</a></li>
      <li><a href="#/completed" data-bind="attr: { class: completedFilterClass }">Completed</a></li>
    <button id="clear-completed" data-bind="click: destroyCompleted, visible: completedCount, text: clearCompletedText">
<div id="info">
  <p>Double-click to edit a todo</p>
  <p>Credits <a href="https://github.com/bsatrom">Brandon Satrom</a>, <a href="https://github.com/burkeholland">Burke Holland</a>, <a href="https://github.com/akorchev">Atanas Korchev</a>, &amp; <a href="https://github.com/jbristowe">John Bristowe</a></p>
  <p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
<script type="text/template" id="item-template">
  <li data-bind="attr: { class: todoItemClass }">
    <div class="view">
      <input class="toggle" type="checkbox" data-bind="checked: completed, events: { change: sync }">
      <label data-bind="text: title, events: { dblclick: startEdit } "></label>
      <button class="destroy" data-bind="click: destroy">
    <input class="edit" data-bind="value: title, events: { blur: endEdit, change: endEdit }, enter: endEdit, escape: cancelEdit">

              var app = app || {};

(function ($, kendo) {
	'use strict';

	var filterBase = {
		field: 'completed',
		operator: 'eq'

	// Route object to manage filtering the todo item list
	var router = new kendo.Router();

	router.route('/', function () {
		app.todoViewModel.set('filter', '');

	router.route('/active', function () {
		filterBase.value = false;
		app.todoViewModel.set('filter', 'active');
	router.route('/completed', function () {
		filterBase.value = true;
		app.todoViewModel.set('filter', 'completed');

	// Todo Model Object
	app.Todo = kendo.data.Model.define({
		id: 'id',
		fields: {
			id: { editable: false, nullable: true },
			title: { type: 'string' },
			completed: { type: 'boolean', nullable: false, defaultValue: false },
			edit: { type: 'boolean', nullable: false, defaultValue: false }

    app.todoData = new kendo.data.DataSource({
      autoSync: true,
      schema: {
        model: app.Todo
      transport: {
        firebase: {
          url: "https://fiery-fire-4452.firebaseio.com/"
      type: "firebase"

	// The core ViewModel for our todo app
	app.todoViewModel = kendo.observable({
		todos: app.todoData,
		filter: null,

		// Main element visibility handler
		isVisible: function () {
			return this.get('todos').data().length ? '' : 'hidden';

		// new todo value
		newTodo: null,
		// Core CRUD Methods
		saveTodo: function () {
			var todos = this.get('todos');
			var newTodo = this.get('newTodo');

			var todo = new app.Todo({
				title: newTodo.trim(),
				completed: false,
				edit: false


			this.set('newTodo', null);

		toggleAll: function () {

			var completed = this.completedTodos().length === this.get('todos').data().length;

			$.grep(this.get('todos').data(), function (el) {
				el.set('completed', !completed);
		startEdit: function (e) {
			e.data.set('edit', true);
			this.set('titleCache', e.data.get('title'));
		endEdit: function (e) {
			var editData = e,

			if (e.data) {
				editData = e.data;
				title = e.data.get('title');

				// If the todo has a title, set it's edit property
				// to false. Otherwise, delete it.
				if (editData.title.trim()) {
					editData.set('title', title.trim());
				} else {

			editData.set('edit', false);
		cancelEdit: function (e) {
			e.set('title', this.get('titleCache'));
			e.set('edit', false);

		destroy: function (e) {
		destroyCompleted: function () {
			$.each(this.completedTodos(), function (index, value) {

		// Methods for retrieving filtered todos and count values
		activeTodos: function () {
			return $.grep(this.get('todos').data(), function (el) {
				return !el.get('completed');
		activeCount: function () {
			return this.activeTodos().length;
		completedTodos: function () {
			return $.grep(this.get('todos').data(), function (el) {
				return el.get('completed');
		completedCount: function () {
			return this.completedTodos().length;

		allCompleted: false,
		// Text value bound methods
		activeCountText: function () {
			return this.activeCount() === 1 ? 'item' : 'items';
		clearCompletedText: function () {
			return 'Clear completed (' + this.completedCount() + ')';

		// Class attribute bound methods
		todoItemClass: function (item) {
			if (item.get('edit')) {
				return 'editing';
			return (item.get('completed') ? 'completed' : 'active');
		allFilterClass: function () {
			return this.get('filter') ? '' : 'selected';
		activeFilterClass: function () {
			return this.get('filter') === 'active' ? 'selected' : '';
		completedFilterClass: function () {
			return this.get('filter') === 'completed' ? 'selected' : '';

	// Bind the ViewModel to the todoapp DOM element
	kendo.bind($('#todoapp'), app.todoViewModel);

}($, kendo));
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................