Replace the Modal definition in your link with the following code. It will make the modal enter from top and exit from bottom.
The basic idea is to make the div exit from the opposite side in a visible way and go back to the origin in an invisible way.
const Modal = posed.div({
enter: {
y: 0,
opacity: 1,
delay: 300,
transition: {
y: { type: 'spring', stiffness: 1000, damping: 15 },
default: { duration: 300 }
}
},
exit: {
y: -50,
opacity:0,
transition: {y:({from,to})=>(
{ type: 'keyframes', values: [from, 50, to], times: [0, 0.99, 1]}),
opacity: ({ from, to }) => (
{ type: 'keyframes', values: [from, 0, to], times: [0, 0.99, 1] })
}
}
});