Menu

What I learned making a wave confirm code
📰

What I learned making a wave confirm code

DEV Community: css·UI Motion AI·4 days ago
#TJjufnk1
#devtocss#devto#dev#cell#border
Reading 0:00
15s threshold

Six digits in, the cells ripple.

A six digit code field where a full entry makes the cells rise one by one and a line grows out from the center.

The trick

Paste, backspace and arrow navigation are handled across the six inputs.

Cells animate with a --gap stagger and fill with the accent when done.

A line scales out from the center under the row.

.cell { position : relative ; width : 52px ; height : 60px ; border : 1px solid var ( --fx-line ) ; transition : border-color . 2s , background-color . 2s } .cell : focus-within { border-color : var ( --fx-ink ) } .cell.filled { border-color : var ( --fx-ink ) } .cell.ok { background : var ( --fx-on ) ; border-color : var ( --fx-on ) } .ln { width : 304px ; height : 2px ; background : var ( --fx-ink ) ; margin : 16px auto 0 ; transform : scaleX ( 0 ) }

Enter fullscreen mode

Exit fullscreen mode

Where I'd use it

Two factor and verification screens

Backspace on an empty cell steps back and clears the previous one, which is the one thing people expect and…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.