JSFiddle - React, Tailwind, and code Playground
HTML
<form action="#" class="contact-us-form">
<input type="text" placeholder="First Name" required>
<input type="text" placeholder="Last name">
<input type="email" placeholder="Email" required>
<button onclick="myFunction()">Click me</button>
</form>
<p id="demo"></p>
SCSS
.contact-us-form {
display: flex;
padding-bottom: 1.25em;
flex-direction: column;
.text-field {
margin: 0.5em;
}
.button-submit {
margin: 1em;
width: 100px;
float: right;
}
input[type="text"],
input[type="email"] {
margin: 0.5em;
height: 2em;
min-width: 125px;
border: 1px solid #eee;
border-left: 3px solid;
border-radius: 4px;
transition: border-color 0.5s ease-out;
&:optional {
border-left-color: #999;
}
&:required {
border-left-color: red;
}
&:invalid {
border-left-color: salmon;
}
}
}
JavaScript
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}