GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

08Theme persistence — a toggle deciding its initial theme from a stored value

Once the theme changes, that value is stored, and once the page is opened again, the stored value is read and the initial theme is set to it before the page is painted.

Best forA dark-mode switch, a service spanning multiple pages

localStoragegetBoundingClientRect--x
Theme persistence — a toggle deciding its initial theme from a stored value
Open in a new tab

08 Theme persistence — a toggle deciding its initial theme from a stored value — Measured area 6.717% · moving frames 12/23Original by GODRICH · SCSS and React ship in the zip · Micro Interactions: 9 Essential UI Patterns

The post this demo lives in

Micro Interactions: 9 Essential UI Patterns - preview of all 9 demosMicro Interactions: 9 Essential UI PatternsMicro interactions: One toast recomputes its dismiss time from its stack order; one compares each heading's viewport ove See all demos in this post

If you like this effect - similar demos