Sha256: b0dd950f8f14d398cb3de6649e527a7e9fe690d05ad9dbff80c0bf99f7196497

Contents?: true

Size: 1.11 KB

Versions: 948

Compression:

Stored size: 1.11 KB

Contents

import React, { useState } from 'react'
import {
  Body,
  Button,
  PbReactPopover,
} from 'playbook-ui'

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

948 entries across 948 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui_docs-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_popover/docs/_popover_z_index.jsx