UNPKG

react-tooltip-com

Version:

A simple React tooltip component with customizable position.

15 lines (14 loc) 645 B
// src/tooltip.tsx import { Fragment, useEffect, useState } from "react"; import "react-tooltip-com/dist/tooltip.css"; import React from "react"; var Tooltip = ({ text, possition, children }) => { const [tooltipClass, setTooltipClass] = useState("tooltip-wrapper-right"); useEffect(() => { setTooltipClass(possition ? `tooltip-wrapper-${possition}` : "tooltip-wrapper-right"); }, [possition]); return /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement("div", { className: tooltipClass }, /* @__PURE__ */ React.createElement("span", { id: "spanText" }, text), children)); }; export { Tooltip };