JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<div class="top">
<!-- ko foreach:boxes -->
<span class="box" data-bind="text:text">
</span>
<!-- /ko -->
<span class="box new">
<button data-bind="click:addBox">+</button>
</span>
</div>
<div id="chart">
Chart
</div>
</div>
CSS
html, body {
height: 100%;
margin: 0;
}
.wrapper {
display: table;
border-collapse: collapse;
border: 1px solid red;
box-sizing: border-box;
height: 100%;
width: 100%;
}
.top {
border: 1px solid magenta;
display: table-row;
}
#chart {
border: 1px solid blue;
display: table-row;
height: 100%;
}
.box {
width: 150px;
height: 50px;
border: 2px solid black;
display: inline-block;
vertical-align: top;
margin: 5px;
}
.box.new {
border: 1px dashed black;
}
.box.new button {
display: inline-block;
width: 100%;
height: 100%;
text-align: center;
font-size: 3em;
border: none;
background: none;
}
JavaScript
function ViewModel() {
var self = this;
self.boxes = ko.observableArray([new Box(0)]);
self.addBox = function () {
self.boxes.push(new Box(self.boxes().length));
}
}
function Box(index) {
self.text = "Box " + index;
}
ko.applyBindings(new ViewModel())