JSFiddle - React, Tailwind, and code Playground
by rich_harris
HTML
<main></main>
<script id='template' type='text/ractive'>
<pre>{{JSON.stringify(item)}}</pre>
<table>
{{#each item:k,i}}
<tr>
<td headers="trans-key">
<!-- this won't update -->
<input type="text" value='{{@key}}' />
</td>
<td headers="trans-value">
<input type="text" value='{{.}}' />
</td>
<td headers="trans-act">
debug: key={{@key}} k={{k}} i={{i}} this={{.}}
<br />
<a on-click="addRow" class="btn add"><i></i></a>
<a on-click="delRow" class="btn delete"><i></i></a>
</td>
</tr>
{{/each}}
</table>
</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;
}
JavaScript
var ractive = new Ractive({
debug: true,
el: 'main',
template: '#template',
data: {
item: {
foo: 1,
bar: 2,
baz: 3
}
}
});