react-popper-tooltip
- Version 4.4.2
- Published
- 93.3 kB
- 3 dependencies
- MIT license
Install
npm i react-popper-tooltip
yarn add react-popper-tooltip
pnpm add react-popper-tooltip
Overview
React tooltip library built around react-popper
Index
Functions
Type Aliases
Functions
function usePopperTooltip
usePopperTooltip: ( config?: Config, popperOptions?: PopperOptions) => { state: import('@popperjs/core').State | null; update: (() => Promise<Partial<import('@popperjs/core').State>>) | null; forceUpdate: (() => void) | null; getArrowProps: (args?: PropsGetterArgs) => { style: React.CSSProperties; 'data-popper-arrow': boolean; }; getTooltipProps: (args?: PropsGetterArgs) => { 'data-popper-interactive': boolean | undefined; style: React.CSSProperties; }; setTooltipRef: React.Dispatch<React.SetStateAction<HTMLElement>>; setTriggerRef: React.Dispatch<React.SetStateAction<HTMLElement>>; tooltipRef: HTMLElement | null; triggerRef: HTMLElement | null; visible: boolean;};
Type Aliases
type Config
type Config = { /** * Whether to close the tooltip when its trigger is out of boundary * @default false */ closeOnTriggerHidden?: boolean; /** * Event or events that trigger the tooltip * @default hover */ trigger?: TriggerType | TriggerType[] | null; /** * Delay in hiding the tooltip (ms) * @default 0 */ delayHide?: number; /** * Delay in showing the tooltip (ms) * @default 0 */ delayShow?: number; /** * Whether to make the tooltip spawn at cursor position * @default false */ followCursor?: boolean; /** * Options to MutationObserver, used internally for updating * tooltip position based on its DOM changes * @default { attributes: true, childList: true, subtree: true } */ mutationObserverOptions?: MutationObserverInit | null; /** * Whether tooltip is shown by default * @default false */ defaultVisible?: boolean; /** * Used to create controlled tooltip */ visible?: boolean; /** * Called when the visibility of the tooltip changes */ onVisibleChange?: (state: boolean) => void; /** * If `true`, a click outside the trigger element closes the tooltip * @default true */ closeOnOutsideClick?: boolean; /** * If `true`, hovering the tooltip will keep it open. Normally tooltip closes when the mouse cursor moves out of * the trigger element. If it moves to the tooltip element, the tooltip stays open. * @default false */ interactive?: boolean; /** * Alias for popper.js placement, see https://popper.js.org/docs/v2/constructors/#placement */ placement?: PopperJS.Placement; /** * Shorthand for popper.js offset modifier, see https://popper.js.org/docs/v2/modifiers/offset/ * @default [0, 6] */ offset?: [number, number];};
type PopperOptions
type PopperOptions = Partial<PopperJS.Options> & { createPopper?: typeof PopperJS.createPopper;};
type PropsGetterArgs
type PropsGetterArgs = { style?: React.CSSProperties; [key: string]: unknown;};
type TriggerType
type TriggerType = 'click' | 'double-click' | 'right-click' | 'hover' | 'focus';
Package Files (3)
Dependencies (3)
Dev Dependencies (35)
- @babel/core
- @babel/plugin-transform-runtime
- @babel/preset-env
- @babel/preset-react
- @babel/preset-typescript
- @storybook/addon-actions
- @storybook/addon-essentials
- @storybook/addon-links
- @storybook/react
- @testing-library/jest-dom
- @testing-library/react
- @testing-library/user-event
- @types/jest
- @types/react
- @types/react-dom
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- babel-loader
- eslint
- eslint-config-prettier
- eslint-plugin-prettier
- eslint-plugin-react
- eslint-plugin-react-hooks
- husky
- jest
- jest-environment-jsdom
- lint-staged
- prettier
- react
- react-dom
- rollup
- rollup-plugin-babel
- rollup-plugin-node-resolve
- rollup-plugin-size-snapshot
- typescript
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-popper-tooltip
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-popper-tooltip)
- HTML<a href="https://www.jsdocs.io/package/react-popper-tooltip"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 990 ms. - Missing or incorrect documentation? Open an issue for this package.