Skip to main content


fires before expanding an item

beforeExpand: (id: Id, dir?: TreeDirection) => boolean | void;


  • id: string | number - the id of an item
  • dir: string - optional, the side the children will be shown in relation to the parent shape ("left" or "right" for type:"topic", otherwise - undefined)


Return false to block expanding an item; otherwise, true.

Example"beforeExpand", function(id, dir) {
console.log("Expanding " +, dir);
return true;

Related sample: Diagram. Org chart mode. Events

Change log:

The dir parameter has been added in v3.1.