<label class="input">
  <input type="email" class="input__field" placeholder="Email">
  <span class="input__label">Email</span>
  <div class="input__icon-hold">
    <span class="input__icon" data-feather="mail"></span>
  </div>
</label>

<button class="button error">toggle error state</button>
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400&display=swap');

*,*::before, *::after {
  box-sizing: border-box;
}

body {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.input {
  $bem-block: &;
  
  position: relative;
  width: 550px;
  height: 70px;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(0,0,0,.25);
  overflow: hidden;
  
  &--error {
    border: 3px #CF4135 solid;
  }
  
  &--success {
    border: 3px #15bc74 solid;
  }
  
  &__field {
    width: 100%;
    height: 100%;
    apperance: none;
    outline: none;
    border: 1px #f3f3f3 solid;
    padding-left: 20px;
    vertical-align: middle;
    font-family: 'Open Sans';
    font-size: 1rem;
    font-weight: 400;
  }
  
  &__label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #C6C6C6;
    opacity: 0;
    font-family: 'Open Sans';
    font-size: 1rem;
    font-weight: 300;
    transition: .3s;
  }
  
  &__icon-hold {
    position: absolute;
    right: 0;
    top: 0;
    background: transparent;
    width: 60px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .3s;
    
    &--error {
      background: #CF4135;
    }
    
    &--success {
      background: #15bc74;
    }
  }
  
  &__icon {
    color: #707070;
      
    &--error,
    &--success {
      color: #fff;
    }
  }
  
  &__field:not(:placeholder-shown) {
    padding-top: 10px;
  }
  
  &__field:not(:placeholder-shown) ~ &__label {
    opacity: 1;
    top: 17px;
    font-size: .875rem;
  }
}

.button {
  display: block;
  margin-top: 20px;
  width: auto;
  outline: none;
  appearance: none;
  background: #fff;
  color: darken(#C6C6C6, 30%);
  border: 1px #f2f2f2 solid;
  border-radius: 4px;
  font-family: 'Open Sans';
  font-size: 1rem;
  padding: 20px 40px;
  cursor: pointer;
  transition: .2s ease-in-out;
  
  &:hover {
    color: #333;
    border-color: #333;
    background: rgba(#333, .1);
  }
}
View Compiled
feather.replace();

$('.error').click(function() {
  $('.input').toggleClass('input--error');
  $('.input__icon-hold').toggleClass('input__icon-hold--error');
  $('.input__icon').toggleClass('input__icon--error');
})
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.24.1/feather.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js