Sha256: d9371209e24e45a568b4cd7203b00fde1b1446e50d0314bfe33b23fa19cb574b

Contents?: true

Size: 1.1 KB

Versions: 929

Compression:

Stored size: 1.1 KB

Contents

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

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

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

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

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

  return (
    <>
      <div style={{ position: 'relative', zIndex: 2 }}>
        <Body
            marginBottom="md"
            text="I've got a z-index of 2"
            {...props}
        />
      </div>
      <PbReactPopover
          closeOnClick="outside"
          offset
          padding="sm"
          placement="top"
          reference={popoverTrigger}
          shouldClosePopover={handleShouldClosePopover}
          show={showPopover}
          zIndex={3}
          {...props}
      >
        {'I have a custom z-index of 3'}
      </PbReactPopover>
    </>
  )
}

export default PopoverZIndex

Version data entries

929 entries across 929 versions & 2 rubygems

Version Path
playbook_ui_docs-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.30.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.29.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.28.0.pre.alpha.PBNTR297gradientoverlay3029 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.28.0.pre.alpha.PBNTR297gradientoverlay3029 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-13.28.0.pre.alpha.dialogturbostreameventlistener3017 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-13.28.0.pre.alpha.dialogturbostreameventlistener3017 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx