JSFiddle - React, Tailwind, and code Playground

HTML

<form id="myForm">
    Username: <input type="text" id="username" pattern=".{2,5}" required />
    <input type="submit" />
</form>