Custom plugins by inheriting the [PluginBase](https://github.com/antvis/G6/blob/fddf9a5c0f7933b4d704038a7474358cb47037d0/packages/g6/src/types/plugin.ts#L15) class.
```ts
import { PluginBase } from '@antv/g6';
class CustomPlugin extends PluginBase {
// Override method
// Class method
}
```
## Override method
### init
**Type**: `() => void`
Initialize the plugin, you need to call the `super.init()` method
### getDefaultCfgs
**Type**: `() => object`
Get the default configuration item of the plugin
### updateCfgs
**Type**: `(cfgs: object) => void`
Update the configuration item of the plugin, the parameter is the current configuration item
### getEvents
**Type**: `() => { [key in string]: string }`
Get the event listener of the plugin
For example, when the mouse enters the node, trigger the plugin class method `handleNodeMouseenter`:
```typescript
getEvents() {
return {
'node:mouseenter': this.handleNodeMouseenter,
};
}
```
### destroy
**Type**: `() => void`
Destroy the plugin, you need to call the `super.destroy()` method
## Example
Here is an example of a simple plugin that creates a text label to display the number of nodes and edges in the current canvas.
```ts
import { Graph as BaseGraph, PluginBase, extend } from '@antv/g6';