JSFiddle - React, Tailwind, and code Playground
HTML
<div id="content">
<div id=dropdownleft>
<button id="phonenumbers" class="dropdown text-left" data-toggle="off">Phone Numbers</button>
<div id="phonenumberscontent" class="content" data-state="closed">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
</div>
</div>
CSS
#dropdowncenter{
text-align: center;
}
#dropdownleft{
text-align: left;
}
#phonenumbers{
color:white;
background-color:#009491;
border:none;
width:702px;
height:50px;
}
#phonenumberscontent{
width:700px;
color:black;
border:1px solid black;
margin:-1px auto;
padding:0;
background-color: none;
margin-bottom: 5px;
}
/* class for all dropdown buttons*/
.dropdown {
position: relative;
}
.content {
display: none;
}
.content[data-state="open"] {
display: block;
}
.dropdown:after {
content: "\25BC"; /*here you can add any image url / sign you want for arrow down*/
position: absolute;
right: 15px;
}
.dropdown[data-toggle="on"]:after {
content: "\25B2"; /*here you can add any image url / sign you want for arrow up*/
}
JavaScript
function toggle_visibility(e) {
var content = e.target.nextElementSibling;
if (content.getAttribute("data-state") === "closed") {
content.setAttribute("data-state", "open");
e.target.setAttribute("data-toggle", "on");
}
else {
content.setAttribute("data-state", "closed");
e.target.setAttribute("data-toggle", "off");
}
}
var btns = document.querySelectorAll(".dropdown");
for (var i = 0, len = btns.length; i < len; i++) {
btns[i].addEventListener("click", toggle_visibility);
}