JSFiddle - React, Tailwind, and code Playground

HTML

<h1>normal</h1>
<input type="text" placeholder="" />
<h1>required (empty)</h1>
<input type="text" required="required" />
<h1>required (not empty)</h1>
<input type="text" required="required" value="value"/>

CSS

input {
  border: 1px solid #5f5;
  background-color: #efe;
}
input[required]:invalid {
  background-color: #fee;
  border: 1px solid #f55;
}