JSFiddle - React, Tailwind, and code Playground
HTML
<div class="svg-wrapper2">
<svg height="175" width="174" xmlns="http://www.w3.org/2000/svg">
<rect class="shape2" height="175" width="174" />
</svg>
</div>
CSS
.svg-wrapper2 {
position: relative;
top:100px;
transform: translateY(-50%);
margin: 0 auto;
width: 320px;
}
.shape2 {
position:relative;
stroke-dasharray: 140 540;
stroke-dashoffset: -474;
stroke-width: 2px;
fill: transparent;
stroke: #c2b6b4;
border-bottom: 6px solid black;
transition: stroke-width 2s, stroke-dashoffset 2s, stroke-dasharray 2s;
}
.svg-wrapper2:hover .shape2 {
position:relative;
stroke-width: 2px;
stroke-dashoffset: 0;
stroke-dasharray: 1000;
}