# @wedgekit/tooltip

> ## Purpose

Latest version **0.0.3** (published 2022-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wedgekit/tooltip
pnpm add @wedgekit/tooltip
yarn add @wedgekit/tooltip
bun add @wedgekit/tooltip
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2022-12-01 |
| First published | 2022-07-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 27.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lphipps, tmclnk, msuiter, rerskine, hpokharel, daniel.z, djkirlin, timmy2654, jfiller, dmsidevel, mada1113, hbiede.dmsi, bpowers_dmsi, jaradpiniarski, kolson, dreadman3716, jgreazel, zkerkman |

## Links

- npm: https://www.npmjs.com/package/@wedgekit/tooltip
- npm.io page: https://npm.io/package/@wedgekit/tooltip

## Dependencies (3)

- [dot-prop](https://npm.io/package/dot-prop.md) ^7.2.0
- [@wedgekit/color](https://npm.io/package/@wedgekit/color.md) ^4.5.3
- [@wedgekit/primitives](https://npm.io/package/@wedgekit/primitives.md) 5.0.1

## Recent versions

- 0.0.3 (latest) — 2022-12-01
- 0.0.4-tc.0 (test) — 2023-02-15
- 0.0.2-tc.1 — 2022-11-29
- 0.0.2-tc.0 — 2022-11-23
- 0.0.2 — 2022-11-09
- 0.0.1 — 2022-11-08
- 0.0.1-tc.0 — 2022-07-08

## README

# Tooltip

## Purpose

The `Tooltip` component is used to provide a pop up to provide more information.

## Basic Implementation

```
import  Tooltip  from '@wedgekit/tooltip';

const Test = () => (
  <Tooltip message="Here is a lot more information about the thing below." suppressFocus>
    {(tooltipProps) => (
      <p {...tooltipProps} tabIndex={0}>I don't have enough information</p>
    )}
  </Tooltip>
);
```

## Props

### children

**The children prop defines the JSX that the Tooltip should be attached to.**

Type: (ToolTipRenderProp) => JSX

required: ✅

This function passes the tooltip render arguments into the child JSX to determine what JSX element the tooltip should be attached to.
For further explanation on the arguments passed into the function see [DOCUMENTATION.md](DOCUMENTATION.md)

### bearings

**The bearings prop defines how the tooltip is positioned relative to the `node`.**

The bearings prop has four properties: `side`, `align`, `offset` and `fallback`:

- `side` defines the position of the tooltip in relation to the node; it defaults to `bottom`
- `align` defines how the tooltip aligns with the node; it defaults to `start`
- `fallback` provides an alternate `side` and `align` if the tooltip is falling off the page; if absent the tooltip will be adjusted until it no longer overhangs the page - possibly covering the `node`

The following illustrates the interaction of `side` and `align`:

![bearings examples](/popover_bearings.png)

**Type: `Bearings`**

```typescript static
type Align = 'start' | 'center' | 'end';
type Side = 'top' | 'bottom' | 'left' | 'right';

type Bearings = {
  align: Align;
  side: Side;
  fallback?: [Side, Align];
};
```

**Required:** ❌

**Default:**

```typescript static
{
  align: 'start',
  side: 'bottom',
}

```

### message

Type: string | JSX

required: ✅

Determines what is displayed in the tooltip component

### suppressFocus

Type: boolean

required: ❌

Suppress the default focus outline on non-interactive elements. This is useful when you have, for example, a `<div>` that will receive the tooltip. The div needs to be focusable for accessibility, but if you just put `<div tabIndex={0}>` you'll get a nasty browser default outline. Suppressing this focus will prevent that from appearing.

This will typically not be set, as usually you will want a user to see where their focus is when the tooltip is open. For example, if it is in a long string of text, the user will want to know what part of text the tooltip is attached to. Only set this option on something like a piece of text that is by itself and that will be obvious what part of the text the tooltip is pointing to (this will probably be a discussion with design).

---
_Source: https://npm.io/package/@wedgekit/tooltip · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
