Skip to content

Animating exit of Radix Popover #70

Answered by rick-hup
Ericlm asked this question in Q&A
Discussion options

You must be logged in to vote

Currently, to implement exit animations, you might need to structure your code like this:

<script setup lang="ts">
import { AnimatePresence, Motion } from 'motion-v'
import { Popover } from 'reka-ui/namespaced'

const open = ref(false)
</script>

<template>
  <div class="px-4">
    <Popover.Root v-model:open="open">
      <Popover.Trigger class="cursor-pointer">
        Toggle popover
      </Popover.Trigger>

      <Popover.Portal>
        <Popover.Content
          as-child
          class="px-4 py-2 bg-pink-400"
          :force-mount="true"
        >
          <AnimatePresence>
            <Motion
              v-if="open"
              :initial="{ opacity: 0, scale: 0.95 }"

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@rick-hup
Comment options

Answer selected by Ericlm
@Ericlm
Comment options

@rick-hup
Comment options

@Ericlm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants