JSFiddle - React, Tailwind, and code Playground
HTML
<div class="dropdown">
<label class="active" for="check"></label>
<input type="checkbox" hidden id="check"/>
<ul class="list">
<li><input type="button" value="11111111" onclick="document.getElementsByClassName('active')[0].innerHTML = this.value;document.getElementById('check').checked = false;"/></li>
<li><input type="button" value="2222222" onclick="document.getElementsByClassName('active')[0].innerHTML = this.value;document.getElementById('check').checked = false;"/></li>
<li><input type="button" value="3333333" onclick="document.getElementsByClassName('active')[0].innerHTML = this.value;document.getElementById('check').checked = false;"/></li>
</ul>
</div>
CSS
.dropdown {
position: relative;
font-size: 16px;
color: #000;
box-sizing: border-box;
max-width: 350px;
}
.active {
display: block;
padding: 5px 10px;
border: 1px solid #000;
height: 30px;
line-height: 30px;
}
.list {
position: absolute;
margin: 0 0 0 auto;
list-style: none;
padding: 0;
border: 1px solid #f00;
display: none;
width: calc(100% - 2px);
}
#check:checked + .list {
display: block;
}
.list li {
border-bottom: 1px solid #f00;
}
.list li input {
background: transparent;
border: none;
padding: 10px 5px;
display: block;
box-shadow: none;
width: 100%;
text-align: left;
}