Socket
Book a DemoInstallSign in
Socket

@deepdub/react-ok-tooltip

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deepdub/react-ok-tooltip

React Ok Tooltip is a simple and easy to use tooltip component for React.

Source
npmnpm
Version
0.1.0-prerelease.2
Version published
Weekly downloads
17
54.55%
Maintainers
3
Weekly downloads
 
Created
Source

React Ok Tooltip

React Ok Tooltip is a simple and easy to use tooltip component for React.

Usage

Inside App.tsx:

import { Tooltip } from '@deepdub/react-ok-tooltip';

// ...

function App() {
  return (
    <>
      {/* insert app here... */}
      <Tooltip arrowSize={5} />
    </>
  );
}

Then, inside Component.tsx:

import { tooltip } from '@deepdub/react-ok-tooltip';

// ...

function Component() {
  return (
    <button {...tooltip('I am a tooltip!')} />
  );
}

Options

Tooltip Options

tooltip() method accepts two parameters: title (a string) and options (an object of shape TooltipProps).

TooltipProps may include any of the follwing:

  • subtitle: string - A subtitle that will appear, well, below the title.
  • maxWidth: string - A string, passed to the tooltip's style.maxWidth.

All are optional.

Global Tooltip Options

Customize the tooltip by passing any of these to <Tooltip>:

  • arrowSize: number - The size of the arrow.
  • backgroundColor: string - The background color of the tooltip.
  • borderColor: string - The border color of the tooltip.

All are optional.

Tooltip Group

React Ok Tooltip also supports a concept we've called "tooltip group".

A tooltip group is a group of tooltips that are displayed at the same location.

Usage

import { tooltip } from '@deepdub/react-ok-tooltip';

// ...

function Component() {
  return (
    <div className="button-group" >
      <button {...tooltip('Cut Selection', { groupId: "clipboard" })}>Cut</button>
      <button {...tooltip('Copy Selection', { groupId: "clipboard" })}>Copy</button>
      <button {...tooltip('Paste', { groupId: "clipboard" })}>Paste</button>
    </div>
  );
}

FAQs

Package last updated on 09 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts