CellVisibility
type CellVisibility = (context) => boolean;
Decides whether a cell is rendered on the paper. Return false to skip
rendering it (handy for viewport culling or hiding cells by state), true to
render it. Pass it to the cellVisibility prop of <Paper>; the callback
receives a structured CellVisibilityParams context instead of the
native positional arguments.
Parameters
| Parameter | Type |
|---|---|
context | CellVisibilityParams |
Returns
boolean
Example
import { GraphProvider, Paper } from '@joint/react';
import type { CellVisibility } from '@joint/react';
// Hide every cell flagged as collapsed.
const cellVisibility: CellVisibility = ({ model }) => !model.get('collapsed');
<GraphProvider>
<Paper cellVisibility={cellVisibility} renderElement={() => <rect width={80} height={40} />} />
</GraphProvider>;