import React, { useState } from 'react' import { Button, Container, Modal, Popper, Typography } from '@toptal/picasso' import { useModal, SPACING_4 } from '@toptal/picasso-utils' const FILLER = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' const ModalWithPopper = ({ open, onClose, }: { open: boolean onClose: () => void }) => { const [anchorEl, setAnchorEl] = useState(null) const popperOpen = Boolean(anchorEl) const handleClick = (event: React.MouseEvent) => { setAnchorEl(popperOpen ? null : event.currentTarget) } return ( Popper inside a scrollable Modal
Scroll down to find the Toggle Popper button. With{' '} disablePortal the Popper renders inside the scrollable container, so floating-ui detects the scroll boundary and flips the Popper upward when there is no room below. {Array.from({ length: 6 }, (_, index) => ( {FILLER} ))} Popper content Popper content Popper content Popper content {Array.from({ length: 6 }, (_, index) => ( {FILLER} ))}
) } const Example = () => { const { showModal, hideModal, isOpen } = useModal() return ( <> ) } export default Example