DEV Community

UI Motion AI
UI Motion AI

Posted on

Account Tile Tabs: the small motion details that make it feel right

Pick an account and the tile fills from the bottom.

Four big account tiles act as tabs, and the selected one fills with the accent while the activity list below changes.

demo

The trick

The fill is a ::before layer scaled on Y from the bottom, so only transform animates.

Rows start in a hidden class and lose it two frames later so they fade in on every switch.

isolation:isolate keeps the fill behind the label without z-index fights.

.t::before{content:"";position:absolute;inset:0;background:var(--acc);transform:scaleY(0);transform-origin:bottom;transition:transform var(--dur) var(--fx-ease);z-index:-1}
.t[aria-selected=true]::before{transform:scaleY(1)}
.t[aria-selected=true]{color:var(--acc-on);border-color:var(--acc)}
.ls .sw{opacity:0}
Enter fullscreen mode Exit fullscreen mode

Where I'd use it

Banking and bookkeeping dashboards

I needed the double requestAnimationFrame to remove the hidden class, one frame is not enough for the browser to register the starting opacity.

The prompt for this one is free: uimotion.app.

Top comments (0)