JSFiddle - React, Tailwind, and code Playground
HTML
<div class="form-fields-group">
<input type="text" id="name" class="form-fields-input" placeholder="Введите название группы" required>
<label class="form-fields-group-label" for="name">Название Группы</label>
</div>
CSS
.form-fields-group {
position: relative;
background: #EAEAEE;
}
.form-fields-group:focus-within {
background: #DDF;
}
.form-fields-group-label {
position: absolute; top: 5px; left: 0;
font-size: 13px;
color: #27252a;
font-family: 'Roboto', sans-serif;
margin-left: 16px;
padding-top: 5px;
}
.form-fields-input {
width: 100%;
padding: 30px 142px 8px 16px;
border: none;
border-radius: 5px;
font-family: 'Roboto', sans-serif;
font-size: 15px;
background: transparent;
}
.form-fields-input:focus + .form-fields-group-label{
color: #00f;
}