Use a button component (like Button, IconButton, or TextButton) to trigger the Popover.
() => { const [isOpen, setIsOpen] = useState(false); return ( <Popover isOpen={isOpen} onClose={() => setIsOpen(false)} trigger={ <IconButton icon={<IconHeart />} onClick={() => setIsOpen(!isOpen)} /> } > Content </Popover> )}
To make the nested buttons tabbable add tabIndex={0}
to them.
() => { const [isOpen, setIsOpen] = useState(false); return ( <Popover isOpen={isOpen} onClose={() => setIsOpen(false)} trigger={ <IconButton icon={<IconDownload />} onClick={() => setIsOpen(!isOpen)} /> } > <Stack gap="s"> <Text>{demoText.m}</Text> <Button tabIndex={0} onClick={() => setIsOpen(false)} hasFullWidth variant="accent">Confirm</Button> <Button tabIndex={0} onClick={() => setIsOpen(false)} hasFullWidth>Done</Button> </Stack> </Popover> )}
() => { const [isOpen, setIsOpen] = useState(false); return ( <Popover isOpen={isOpen} onClose={() => setIsOpen(false)} placement="right" offset="l" trigger={ <IconButton icon={<IconHeart />} onClick={() => setIsOpen(!isOpen)} /> } > Content </Popover> )}
() => { const [isOpen, setIsOpen] = useState(false); return ( <Popover isOpen={isOpen} onClose={() => setIsOpen(false)} placement="right" trigger={ <IconButton icon={<IconHeart />} onClick={() => setIsOpen(!isOpen)} /> } > Content </Popover> )}
() => { const [isOpen, setIsOpen] = useState(false); return ( <Popover isOpen={isOpen} onClose={() => setIsOpen(false)} placement="right" width="max-content" padding="s" trigger={ <IconButton icon={<IconSmile />} onClick={() => setIsOpen(!isOpen)} /> } > {demoText.s} </Popover> )}