Skip to main content


The Toolkit offers a reverse text search engine on the contents of each of the nodes/groups/edges in a given Toolkit instance.


Using the search package is straightforward:

import { newInstance, Index } from "@jsplumbtoolkit/browser-ui"

const tk = newInstance()
const index = new Index(tk)

At this point we have an instance of the search index, linked to the given Toolkit instance. The search index exposes a single search(s:string) method:

tk.addNode({id:"1", foo:"bar"})

const results ="bar")

results is an object of type jsPlumbToolkitSearchResults:

Home > @jsplumbtoolkit/browser-ui > jsPlumbToolkitSearchResults

jsPlumbToolkitSearchResults type

Results from a text search


export declare type jsPlumbToolkitSearchResults = {
nodes: Array<Node>;
groups: Array<Group>;
edges: Array<Edge>;
ports: Array<Port>;

References: Node, Group, Edge, Port


In the code snippets shown above, we instantiate a search index with all of its defaults. But the search index constructor takes an optional second argument containing options for the index. The options type is:

Home > @jsplumbtoolkit/browser-ui > jsPlumbToolkitSearchIndexOptions

jsPlumbToolkitSearchIndexOptions interface

Options for the search index.


export interface jsPlumbToolkitSearchIndexOptions 


caseSensitive?boolean(Optional) Whether or not the search index should ignore case. By default this is false.
exclusions?Array<string>(Optional) Optional list of field names to omit from the documents stored for each node. This means that any field in this list will not be indexed.
fields?Array<string>(Optional) Optional list of fields to index. By default this is empty, meaning all fields (minus any exclusions) will be indexed.
limit?number(Optional) Optional limit for the number of result a search should return. Defaults to 10.