JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="selected"></ul>
<ul id="selector">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
</ul>
CSS
#selector {
position: absolute;
top: 60px;
left: 8px;
z-index: 100;
padding: 8px;
background: hsla(0, 100%, 100%, 0.80);
-webkit-box-shadow: 0 0 25px rgba(0,0,0,0.25);
-moz-box-shadow: 0 0 25px rgba(0,0,0,0.25);
box-shadow: 0 0 25px rgba(0,0,0,0.25);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#selected li, #selector li {
display: inline-block;
width: 40px;
height: 40px;
background: hsl(0, 0%, 93%);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
margin-right: 1px;
margin-bottom: 1px;
cursor: pointer;
overflow: hidden;
float: left;
text-shadow: 0 1px 0 #FFF;
font-size: 22px;
line-height: 40px;
text-align: center;
}
#selected li:hover, #selector li:hover {
background: hsl(0, 0%, 87%);
}
JavaScript
$.fn.hSlide = function(state, speed, easing, callback) {
return this.animate({
width: state,
marginLeft: state,
marginRight: state,
paddingLeft: state,
paddingRight: state
}, speed, easing, callback);
};
$(document).ready(function() {
var speed = 'slow';
$('#selector li').click(function() {
var elem = $(this);
var selected = $(this).clone().hide().appendTo('#selected').hSlide('show', speed).click(function() {
elem.hSlide('show', speed);
selected.hSlide('hide', speed, function() {
selected.remove();
}).unbind('click');
});
elem.hSlide('hide', speed);
});
});