JSFiddle - React, Tailwind, and code Playground
HTML
<div id="panel">
<div class="square1"></div>
<div class="square2"></div>
<div class="square3"></div>
<div class="square4"></div>
<div class="square5"></div>
</div>
<div id="canvas">
</div>
CSS
#panel
{
width:200px;
height:400px;
border:1px solid black;
margin-right:10px;
float:right;
}
.square1
{
width:50px;
height:50px;
margin-top:10px;
background:yellow;
}
.square2
{
width:50px;
height:50px;
margin-top:10px;
background:black;
}
.square3
{
width:50px;
height:50px;
margin-top:10px;
background:blue;
}
.square4
{
width:50px;
height:50px;
margin-top:10px;
background:green;
}
.square5
{
width:50px;
height:50px;
margin-top:10px;
background:red;
}
#canvas
{
width:300px;
height:300px;
border:1px solid black;
float:left;
position:relative;
}
JavaScript
$('.square1').draggable({
revert:"valid",
helper:"clone"
});
$('.square2').draggable({
revert:"valid",
helper:"clone"
});
$('.square3').draggable({
revert:"valid",
helper:"clone"
});
$('.square4').draggable({
revert:"valid",
helper:"clone"
});
$('.square5').draggable({
revert:"valid",
helper:"clone"
});
$('#canvas').droppable({
drop: function (e, ui) {
$(ui.draggable).clone().appendTo($(this));
}
})