JSFiddle - React, Tailwind, and code Playground
by Newton Anbarasu
HTML
<div id="search">
<label for="btn">click</label>
<input type="checkbox" id="btn" />
<input type="text" placeholder="Enter to search ..." />
</div>
CSS
#search {
position: relative;
width: 380px;
height: 58px;
overflow: hidden;
margin: 50px auto;
}
#search label {
background: #E67E22;
color: #FFF;
font-size: 40px;
padding: 5px 15px;
cursor: pointer;
position: absolute;
right: 0;
z-index: 2;
width:35px;
line-height:45px;
height:50px;
font-size:18px;
}
#search input[type=checkbox] {
position: absolute;
top: -9999px;
left: -9999px;
}
#search input[type=text] {
font-size: 24px;
padding: 15px 10px;
width: 200px;
background: #FFF;
color: #fff;
cursor:text;
position: absolute;
right: -265px;
z-index: -1;
transition: right 2s;
background:grey;
line-height:18px;
}
#search input[type=checkbox]:checked ~ input[type=text] {
right: 63px;
z-index: 0;
}