Border field, CSS only

The same field with no JavaScript on the page. The outline morphs between its shapes with CSS alone, and the form is an ordinary form: the browser's own validation decides what's wrong. The JavaScript sandbox is still there; this is the other way to build it.

That doesn’t look like an email address yet.On its way. Check your inbox to confirm.

Type, leave it half done and click away, then send a good one. Sending reloads this page at #live-done, a hidden marker inside the form, and :target plays the burst. The marker has no box, so the page doesn't jump to it.

Every state

Held in place so they can be seen side by side. On a real page, typing and error come from the input, and loading and sent from an attribute the server sets.

Rest. A plain rounded box.

Typing. A soft cloud that breathes. It can't follow the caret.

Loading. data-state="loading": the wave runs round.

Error. :user-invalid: red teeth and a shake.

Sent. data-state="sent": a sunburst and the border as confetti, on a loop here.

CSS only, or JavaScript

CSS onlyWith border-field.js
TypingA breathing cloud while there's textA swell that follows the caret, nudged by each key
Error:user-invalid, once the reader has touched the fieldOn send, and cleared as soon as it's fixed
Loading and sentAn attribute the page sets, or a hidden :target marker after a normal submitDriven by your onSubmit
MorphingChrome, Edge and Firefox morph the line. Safari cross-fades between shapes.Every browser
WidthDrawn for one size and stretched, so the waves widen on wide fieldsFits any size
SettingsEdit and rerun pnpm forms:cssLive, and in the sandbox