JSFiddle - React, Tailwind, and code Playground

by rich_harris

HTML

<script src="https://rawgit.com/ractivejs/ractive-transitions-slide/master/ractive-transitions-slide.js"></script>
<main></main>

<script id='template' type='text/ractive'>
    <div class='expandable'>
        <button on-click='toggle("showDetail")'>toggle detail</button>
        {{#if showDetail}}
            <div class='detail' intro-outro='slide'>
                <p>Here is some more detail!</p>
                <button on-click='set("showDetail",false)'>hide detail</button>
            </div>
        {{/if}}
    </div>
</script>

CSS

body {
    font-family: 'Helvetica Neue', arial, sans-serif;
    font-weight: 200;
    color: #353535;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 200;
}

button {
    margin: 0 0 1em 0;
}

button:last-child {
    margin: 0;
}

.detail {
    background-color: #eee;
    border: 1px solid #ddd;
    padding: 1em;
}

.error {
    color: #d00;
    font-family: monospace;
}

JavaScript

var ractive = new Ractive({
    el: 'main',
    template: '#template'
});