JSFiddle - React, Tailwind, and code Playground
by rich_harris
HTML
<main></main>
<script id='template' type='text/ractive'>
<h2>1. select a transition</h2>
<select value='{{dynamic}}'>
<option>foo</option>
<option>bar</option>
</select>
<h2>2. toggle visibility</h2>
<label>
<input type='checkbox' checked='{{visible}}'/> visible
</label>
{{#if visible}}
<div intro='{{dynamic}}'>hello world</div>
{{/if}}
</script>
CSS
body {
font-family: 'Helvetica Neue', arial, sans-serif;
font-weight: 200;
color: #353535;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 200;
}
.error {
color: #d00;
font-family: monospace;
}
label {
display: block;
margin: 0 0 1em 0;
}
JavaScript
var ractive = new Ractive({
el: 'main',
template: '#template',
transitions: {
foo: function ( t ) {
t.node.innerHTML = 'foo transition';
},
bar: function ( t ) {
t.node.innerHTML = 'bar transition';
}
}
});