Animation | SlideTransition
SlideTransition#
Description#
- The directional slide between two sections that share the same place: from the notification center to quick settings and back, or between screens of the same panel.
directionis the side the new section enters from; the one leaving goes to the opposite side, so going and coming back reads as two steps of the same path. It enters in 200 ms withease-ui-outand leaves in 150 ms withease-in, 16 px and opacity: enough to notice where it comes from without the content crossing the window.
Props#
direction('left' | 'right' | 'up' | 'down') — The side the new section enters from; the previous one leaves the opposite way.rightby default.mode('out-in' | 'in-out') —out-inso the two sections do not coexist on screen.appear(boolean) — Runs the transition on the first mount too.onEnter/onLeave((el: Element, done: () => void) => void) — JavaScript enter and leave hooks. If they receivedone, it has to be called.
Emits#
beforeEnter,afterEnter,enterCancelled,beforeLeave,afterLeave,leaveCancelled— The<Transition>hooks, with the element as payload.
Slot#
- The default one: the section that enters or leaves.
Usage#
| |
Notes#
- For going and coming back to read as the same path,
directionchanges together with the target section: to the right when going back, to the left when entering. - With
prefers-reduced-motiononly the opacity remains (motion-reduce:), as inAppletPopover. - Only
opacityandtranslatemove, which compose without redoing the layout. - The durations are the
duration-150andduration-200classes, not a token: the design guard only accepts 100/150/200/300. enterandleavecome as theonEnterandonLeaveprops, not as events, for the same reason as inRevealTransition:<Transition>counts the function’s parameters to know whether to wait fordone.