Skip to content

Menu open close animation Tailwindcss #2744

Answered by erhankaradeniz
IRediTOTO asked this question in Help
Discussion options

You must be logged in to vote

You will need to wrap you component where you want to apply the animation on with the transition component from import { Transition } from "@headlessui/react" You can find the repo here: https://github.com/tailwindlabs/headlessui

after that you can use the classes based on you're menuOpen state like so:

<Transition
            show={menuOpen}
            enter="duration-200 ease-out"
            enterFrom="opacity-0 scale-95"
            enterTo="opacity-100 scale-100"
            leave="duration-100 ease-in"
            leaveFrom="opacity-100 scale-100"
            leaveTo="opacity-0 scale-95"
          >
          <div className={use only styles for the element here, no animation classe…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by IRediTOTO
Comment options

You must be logged in to vote
2 replies
@erhankaradeniz
Comment options

@noconsulate
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants