# motion/collapse (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/motion/collapse.ts](https://github.com/Tahul/zidane/blob/main/ui/src/motion/collapse.ts).

## Functions

### `useStaysMounted`

Function.

`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).

```ts
function useStaysMounted(open: boolean): boolean
```

**Parameters**

- `open` (`boolean`): Whether the collapsible is open.

**Returns** `boolean`: `true` while it is open or still playing its close.

Source: [ui/src/motion/collapse.ts:19](https://github.com/Tahul/zidane/blob/main/ui/src/motion/collapse.ts#L19)
