Skip to main content
Version: 4.3

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

ParameterType
contextCellVisibilityParams

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>;

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub