Menu

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

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

DEV Community: css·UI Motion AI·6 days ago
#x273Okxg
#devtocss#devto#dev#transform#bottom
Reading 0:00
15s threshold

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.

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…

Continue reading — create a free account

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