Sha256: ecfc1334285a4228b28aca71c990848daeaeacf2605c853f1e4ca247a7ef3e57

Contents?: true

Size: 839 Bytes

Versions: 23

Compression:

Stored size: 839 Bytes

Contents

import React, { useState } from 'react'
import {
  Button,
  PbReactPopover,
} from '../..'

const PopoverClickOutside = () => {
  const [showPopover, setShowPopover] = useState(false)

  const handleTogglePopover = () => {
    setShowPopover(!showPopover)
  }

  const handleShouldClosePopover = (shouldClosePopover) => {
    setShowPopover(!shouldClosePopover)
  }

  const popoverTrigger = (
    <Button
        onClick={handleTogglePopover}
        text="Button Secondary"
        variant="secondary"
    />
  )

  return (
    <PbReactPopover
        closeOnClick="outside"
        offset
        placement="bottom"
        reference={popoverTrigger}
        shouldClosePopover={handleShouldClosePopover}
        show={showPopover}
    >
      {'Whoa. I\'m a popover.'}
    </PbReactPopover>
  )
}

export default PopoverClickOutside

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
playbook_ui-4.8.1 app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.jsx
playbook_ui-4.7.1 app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.jsx
playbook_ui-4.7.0 app/pb_kits/playbook/pb_popover/docs/_popover_click_outside.jsx