<!-- Do not edit this file. It is automatically generated by API Documenter. --> [`Workspace`](Workspace) › [on('active-leaf-change')](Workspace/on('active-leaf-change').md) ## Workspace.on('active-leaf-change') method Triggered when the active leaf changes. 0.10.9 **Signature:** ```typescript on(name: 'active-leaf-change', callback: (leaf: WorkspaceLeaf | null) => any, ctx?: any): EventRef; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | <code>name</code> | <code>'active-leaf-change'</code> | | | <code>callback</code> | <code>(leaf: </code>[`WorkspaceLeaf`](WorkspaceLeaf)<code> &#124; null) =&gt; any</code> | | | <code>ctx</code> | <code>any</code> | _(Optional)_ | **Returns:** [`EventRef`](EventRef)