How to create simmilar buttons on js?

Hello !
I’m trying to create similar functionality in js.
How to create simmilar buttons on js ?

Here’s the code and on codepen https://codepen.io/shchdmitrii/pen/ExWvbZZ

<style>
.tab {
  padding: 0 0 0 8px;
  width: 100%;
}
@media screen and (min-width: 1112px) {
  .tab {
    padding: 0 0 0 16px;
  }
}
.tab-nav {
  display: flex;
  margin-bottom: 10px;
}
.tab-nav > .nav {
  border-image-source: url(../images/smth.png);
  border-image-slice: 24 fill;
  border-image-repeat: repeat;
  border-image-width: 12px;
  box-sizing: content-box;
  display: inline-block;
  height: 36px;
  line-height: 36px;
  padding: 0 9px;
  position: relative;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  white-space: nowrap;
  width: 100%;
  flex: 1;
  text-align: center;
}
@media screen and (min-width: 1112px) {
  .tab-nav > .nav {
    height: 58px;
    line-height: 56px;
  }
}
.tab-nav > .nav:not(:last-child) {
  margin-right: 8px;
}
.tab-nav .ctrl-label {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  display: block;
  cursor: pointer;
  margin: 0;
}
.tab-container {
  overflow: none;
}
.tab-container-block {
  display: none;
  height: 100%;
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
}
.tab .ctrl-radios {
  display: none;
}
.tab #tab-0-ctrl:checked ~ .tab-container #tab-0 {
  display: block;
}
.tab #tab-1-ctrl:checked ~ .tab-container #tab-1 {
  display: block;
}
.tab #tab-2-ctrl:checked ~ .tab-container #tab-2 {
  display: block;
}
.tab #tab-3-ctrl:checked ~ .tab-container #tab-3 {
  display: block;
}
.tab #tab-0-ctrl:checked ~ .tab-nav #nav-0 {
  border-image-source: url(../images/smth1.png);
}
.tab #tab-1-ctrl:checked ~ .tab-nav #nav-1 {
  border-image-source: url(../images/smth1.png);
}
.tab #tab-2-ctrl:checked ~ .tab-nav #nav-2 {
  border-image-source: url(../images/smth1.png);
}
.tab #tab-3-ctrl:checked ~ .tab-nav #nav-3 {
  border-image-source: url(../images/smth1.png);
}

</style>
<div class="tab">
  <input id="tab-0-ctrl" class="ctrl-radios" type="radio" name="tab-radios">
  <input id="tab-1-ctrl" class="ctrl-radios" type="radio" name="tab-radios">
  <input id="tab-2-ctrl" class="ctrl-radios" type="radio" name="tab-radios">
  <input id="tab-3-ctrl" class="ctrl-radios" type="radio" name="tab-radios">

  <div class="nav" id="nav-0">
    <label class="ctrl-label" for="tab-0-ctrl">Test 0</label>
  </div>
  
  <div class="nav" id="nav-1">
    <label class="ctrl-label" for="tab-1-ctrl">Test 1</label>
  </div>
  
  <div class="nav" id="nav-2">
    <label class="ctrl-label" for="tab-2-ctrl">Test 2</label>
  </div>
  
  <div class="nav" id="nav-3">
    <label class="ctrl-label" for="tab-3-ctrl">Test 3</label>
  </div>

  <div class="tab-container">
    <div class="tab-container-block" id="tab-0">
      <ul class="grid-view" data-grid="vertical">
        <h2>Test 0</h2>
      </ul>
      <h2>test main</h2>
    </div>

    <div class="tab-container-block" id="tab-1">
      <ul class="grid-view" data-grid="vertical">
        <h2>Test 1</h2>
      </ul>
    </div>

    <div class="tab-container-block" id="tab-2">
      <h2>Test 2</h2>
    </div>

    <div class="tab-container-block" id="tab-3">
      <ul class="grid-view" data-grid="vertical">
        <h2>Test3</h2>
      </ul>
    </div>
  </div>
</div>

shchdmitrii