Sha256: 051e39ee32bfa72db86f21b45a96ac662f0d6c857f50414da02376f393790ba5

Contents?: true

Size: 1.03 KB

Versions: 145

Compression:

Stored size: 1.03 KB

Contents

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

const PopoverZIndex = () => {
  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"
        />
      </div>
      <PbReactPopover
          closeOnClick="outside"
          offset
          placement="top"
          reference={popoverTrigger}
          shouldClosePopover={handleShouldClosePopover}
          show={showPopover}
          zIndex={3}
      >
        {'I have a custom z-index of 3'}
      </PbReactPopover>
    </>
  )
}

export default PopoverZIndex

Version data entries

145 entries across 145 versions & 1 rubygems

Version Path
playbook_ui-6.8.1 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.8.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.7.0.pre.alpha1 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.7.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.6.1 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.0.pre.alpha10 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.6.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.5.2 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha12 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha11 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha10 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha9 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.5.1 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-6.5.0 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha8 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha7 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha6 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha5 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha4 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-7.0.1.pre.alpha3 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx