JSFiddle - React, Tailwind, and code Playground

by LuckyCat

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div class="checkbox-block">
  <div class="checkbox-item tr-option">
    Test text 1
  </div>
  <div class="checkbox-item tr-option">
    Test text 2
  </div>
  <div class="checkbox-item tr-option">
    Test text 3
  </div>
  <div class="checkbox-item tr-option">
    Test text 4
  </div>
</div>

CSS

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:focus {
  outline: 0;
}

img {
  border: none;
  display: block;
}

ol,
ul {
  list-style: none;
}

a {
  text-decoration: none;
  cursor: pointer !important;
}

html {
  font-size: 62.5%;
  -webkit-text-size-adjust: 100%;
  position: relative;
}

body {
  font-family: Arial, sans-serif;
  color: #333;
  line-height: 1.3;
  font-size: 1.6rem;
}

.checkbox-block {
  margin-top: 2rem;
}

.checkbox-item {
  position: relative;
  padding: 0 0 0 4.5rem;
  margin-bottom: 2rem;
  text-align: left;
  line-height: 3rem;
  cursor: pointer;
  transition: all 0.3s linear;
}

.checkbox-item::before {
  content: "";
  position: absolute;
  width: 3rem;
  height: 3rem;
  border: 1px solid #d3cfc8;
  top: 0;
  left: 0;
  line-height: 2.2rem;
  color: #fff;
  font-family: Arial, sans-serif;
  font-weight: bold;
  font-size: 1.6rem;
  text-align: center;
}

.checkbox-item.checked::before {
  background-color: #de9c7d;
}

.checkbox-item.checked::after {
  content: '';
  display: block;
  position: absolute;
  top: 0.1rem;
  left: 0.9rem;
  border: 0.6rem solid #fff;
  border-left: 0;
  border-top: 0;
  width: 0.8rem;
  height: 1.7rem;
  transform: rotate(45deg);
}

JavaScript

$('.checkbox-item').on('click', function() {
    if ($(this).siblings('.checked').length < 3) {
        $(this).toggleClass('checked tr-selected');
    }
});