G
Tokens
TypographySpacingColorRadiusShadowMotion

Popover

Trigger

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>
    )}
  

Content

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>
    )}
  

Offset


    () => {
    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>
    )}
  

Placement


    () => {
    const [isOpen, setIsOpen] = useState(false);
    return (
      <Popover
        isOpen={isOpen}
        onClose={() => setIsOpen(false)}
        placement="right"
        trigger={
          <IconButton
            icon={<IconHeart />}
            onClick={() => setIsOpen(!isOpen)}
          />
        }
      >
        Content
      </Popover>
    )}
  

Demo

topStart
top
topEnd
leftStart
Trigger
rightStart
left
right
leftEnd
rightEnd
bottomStart
bottom
bottomEnd

Width and padding


    () => {
    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>
    )}
  

Props

Name
Type
Default
padding
oneOfType
number
string
'l'
placement
oneOf
'top' 'topStart' 'topEnd' 'bottom' 'bottomStart' 'bottomEnd' 'right' 'rightStart' 'rightEnd' 'left' 'leftStart' 'leftEnd'
'bottom'
width
oneOfType
number
string
'256px'
zIndex
oneOfType
number
string
1
hasPortal
bool
true
offset
oneOfType
oneOf
"xs" "s" "s2" "m" "l" "l2" "xl" "xl2" "xxl"
number
string
'xs'
strategy
oneOf
'absolute' 'fixed'
'fixed'
trigger
node
isOpen
bool
onCloseREQUIRED
func