Motion
DIYA moves only when something changes because of you: a menu grows from the button you pressed, a tab’s underline follows your choice, a dialog settles into place. It’s quick and quiet, and you can turn it off.
Press Play to watch each duration. Each dot crosses in its time and comes back in two-thirds of it.
Durations
--diya-duration-fast120ms in · 80ms out--diya-duration-medium160ms in · 107ms out--diya-duration-slow240ms in · 160ms out
Curves, at the slow duration
--diya-ease-enterArrive and settle--diya-ease-exitLeave without lingering--diya-ease-moveMove or change on screen
What moves
- PopupsMenus, popovers, tooltips and lists grow out of the control that opened them, and sink back into it when they close.
- Dialogs and drawersA dialog settles in from slightly smaller while the page dims; a drawer slides in from its own edge.
- ToastsA toast rises a short way from the edge it lives on.
- SelectionA tab’s indicator slides to your choice, a switch’s thumb slides across, and a radio dot or a check grows in.
- AccordionA section opens to its own height, so you keep your place.
- Buttons and progressHover eases in, a press lands at once, and a progress bar eases to each new value.
Everything leaves a little faster than it arrived, and nothing waits for motion: you can type, click or press Escape while something is still moving.
Tokens
Exits take about two-thirds of the enter, automatically. Set these on the provider, like any DIYA token.
--diya-duration-fast- 120ms in, 80ms outHover, press, toggles and color changes.
--diya-duration-medium- 160ms in, 107ms outMenus, popovers, tooltips and lists.
--diya-duration-slow- 240ms in, 160ms outDialogs, drawers, toasts, Tabs and Accordion.
--diya-duration-scale- 1Multiplies every duration: 0.5 is twice as fast, 0 turns motion off.
--diya-ease-enter- cubic-bezier(0.2, 0.7, 0.2, 1)Anything appearing.
--diya-ease-exit- cubic-bezier(0.4, 0, 1, 1)Anything going away.
--diya-ease-move- cubic-bezier(0.4, 0, 0.2, 1)Moves and color changes on screen.
Less motion, or none
DIYA follows the device’s Reduce Motion setting (Reduce Motion on Apple devices, Animation effects on Windows, Remove animations on Android): nothing slides or scales, and fades stay, so every change is still visible.
Chrome and Edge play every enter and exit. Safari and Firefox play the enters; some exits are instant.
Set it up
With no code, DIYA moves and follows the device’s Reduce Motion setting. To change that:
Turn it off for the whole app: add
motion="off"to yourDiyaProvider. Everything changes at once, as in 1.0; loading indicators still move, because they show progress.<DiyaProvider motion="off"> {children} </DiyaProvider>Fades only, for everyone: add
motion="reduced". Nothing slides or scales, but changes still ease in and out.<DiyaProvider motion="reduced"> {children} </DiyaProvider>One part of the app gets its own setting from a nested provider. Without
motion, a nested provider inherits the one around it.<DiyaProvider motion="reduced"> <LiveFeed /> </DiyaProvider>Faster, slower or off in CSS:
--diya-duration-scalemultiplies every duration. Set it on the provider (itsstyleorclassName) or above it; on an element inside the provider it has no effect. For one region, use a nestedDiyaProvider..diya-root { --diya-duration-scale: 0.5; }In unit tests, render inside
motion="off": closing popups leave at once and a tooltip shows on hover without its 300ms wait.render( <DiyaProvider motion="off"> <Settings /> </DiyaProvider> )In end-to-end tests, closing popups stay up to 160ms and Playwright’s
getByRolestill finds them. Use web-first assertions (await expect(menu).toBeHidden()), or rendermotion="off"in your test build. Emulating reduced motion isn’t enough, since things still fade.<DiyaProvider motion={process.env.NEXT_PUBLIC_E2E ? 'off' : undefined}> {children} </DiyaProvider>Rather keep 1.0 exactly? Pin the 1.0 line.
npm install @idyeah/diya@~1.0.1
useDiyaAppearance().motion tells your own code which applies: 'full', 'reduced' or 'off'. There’s no motion="full": DIYA never overrides a reader who asked for less motion.