Skip to content
A Javascript Framework for Building Brilliant Applications (development repo)
HTML JavaScript CSS
Latest commit fcf6e16 @lhorie Merge pull request #975 from barneycarroll/empty-attrs-string
Empty attributes. Fixes #971
Failed to load latest commit information.
archive v0.2.3
bench Remove an erroneous npm-debug.log, disable failing test
deploy #518 fix package.json file for cdn.js
docs fix broken link in mithril.deps.md
test-deps Merge branch 'next' of https://github.com/lhorie/mithril.js into test…
test Empty attributes. Fixes #971
tests Empty attributes. Fixes #971
.editorconfig tweak editorconfig preferences
.eslintignore Remove an erroneous npm-debug.log, disable failing test
.eslintrc Merge 'origin/patch-2', remove trailing commas
.gitattributes Minified files are binary enough to count.
.gitignore Remove an erroneous npm-debug.log, disable failing test
.npmignore adds saucelabs integration to unit tests
.travis.yml Convert tests to Mocha/Chai/Sinon and lint them.
CONTRIBUTING.md v0.2.2-rc.1
Gruntfile.js Make linter happy with Mithril.js
LICENSE Initial commit
README.md Small documentation tweak
mithril.closure-compiler-externs.js Update externs for Google Closure compiler
mithril.d.ts Remove ugly alias for m
mithril.js Merge pull request #975 from barneycarroll/empty-attrs-string
mithril.min.js trailing semi-colon
mithril.min.js.map fix version string
package.json Merge pull request #972 from isiahmeadows/test-fix

README.md

JS.ORG Join the chat at https://gitter.im/lhorie/mithril.js Build Status

Mithril

A Javascript Framework for Building Brilliant Applications

See the website for documentation

There's also a blog and a mailing list


What is Mithril?

Mithril is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.

Light-weight

  • Only 7.8 kB gzipped, no dependencies
  • Small API, small learning curve

Robust

  • Safe-by-default templates
  • Hierarchical MVC via components

Fast

  • Virtual DOM diffing and compilable templates
  • Intelligent auto-redrawing system

Sample code

//namespace
var app = {};

//model
app.PageList = function() {
    return m.request({method: "GET", url: "pages.json"});
};

//controller
app.controller = function() {
    var pages = app.PageList();
    return {
        pages: pages,
        rotate: function() {
            pages().push(pages().shift());
        }
    }
};

//view
app.view = function(ctrl) {
    return [
        ctrl.pages().map(function(page) {
            return m("a", {href: page.url}, page.title);
        }),
        m("button", {onclick: ctrl.rotate}, "Rotate links")
    ];
};


//initialize
m.mount(document.getElementById("example"), app);

Learn more

Something went wrong with that request. Please try again.