Skip to content

Instantly share code, notes, and snippets.

View magalhaespaulo's full-sized avatar

magalhaespaulo

View GitHub Profile
______ __ _ ______ __ __ __ _
| ___| | | | ___| |/ / | | | |
| ___| |_| | |__| \ | |_| |
|___| |______|______|__|\__\ |______|
@magalhaespaulo
magalhaespaulo / Modal.tsx
Last active June 1, 2023 21:46
Accessible <Modal /> with Framer Motion and Tailwind CSS
// Accessible Modal.tsx with
// Framer Motion and Tailwind CSS
// 10 Examples in the comments section below
import { createPortal } from 'react-dom'
import { Dispatch, HTMLAttributes, SetStateAction, useEffect, useState } from 'react'
import { AnimatePresence, motion } from 'framer-motion'
import FocusLock from 'react-focus-lock'
const effect = {
hidden: {