Skip to content

motion/collapse

import { … } from 'zidane-ui'ui/src/motion/collapse.ts

Functions#

useStaysMountedFunction#

open, held true until a .zg-collapsible has finished closing. Content rendered only while open ({open && …}) vanishes on the first frame of a close: the collapse animates an empty box while everything below jumps up. Render it while this is true instead: it mounts at once on open and unmounts once the collapse has played (readExitMs(), read when the close starts: at once with motion off).

TypeScript
function useStaysMounted(open: boolean): boolean
Parameters
NameTypeDescription
openboolean

Whether the collapsible is open.

boolean

true while it is open or still playing its close.

ui/src/motion/collapse.ts:19