Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

denisborovikov/react-popper-tooltip-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-popper-tooltip-hook

Experimenting with possible hook API for react-popper-tooltip.

Updated: Eventually it was released as react-popper-tooltip version 4.

Codesandbox.

const {
  arrowRef,
  tooltipRef,
  triggerRef,
  getArrowProps,
  getTooltipProps,
  setArrowRef,
  setTooltipRef,
  setTriggerRef,
  visible,
  ...popperProps
} = usePopperTooltip(config, popperOptions);
<>
  <button type="button" ref={setTriggerRef}>
    Reference element
  </button>

  {visible && (
    <div
      ref={setTooltipRef}
      {...getTooltipProps({ className: "tooltip-container" })}
    >
      Popper element
      <div
        ref={setArrowRef}
        {...getArrowProps({ className: "tooltip-arrow" })}
      />
    </div>
  )}
</>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published