tooltip
A tooltip on each cell, computed from the data.
| Type | (value: V | null, row: Readonly<T>, context: unknown) => string | null |
|---|---|
| Default | not set |
Live update (update()) | Yes — give the columns again (update({ columns })) |
| Declared in | packages/core/src/columns/defs.ts |
What it does
Section titled “What it does”tooltip(value, row, context) returns the text, already translated, or null for none; context is the
grid’s context. The grid never guesses one from the cell’s content. It shows when the
pointer rests on the cell (after the grid’s tooltips delay) and as soon as the keyboard
focus reaches it.
Example
Section titled “Example”import { createGrid } from '@dzgrid/dom';import { EN } from '@dzgrid/dom/locales/en';
type Bee = { id: string; hive: string; honey: number };
createGrid<Bee>(document.getElementById('hives')!, { rows: [{ id: 'h1', hive: 'Clover hill', honey: 12.5 }], columns: [ { id: 'hive', header: 'Hive', tooltip: (v) => (v ? `Hive ${v}` : null) }, { id: 'honey', header: 'Honey', type: 'number' }, ], getRowId: (r) => r.id, messages: EN,});