# PluginDependency

> _Since v0.4.1_

Declares a dependency on another plugin.

#### Example

```typescript
export class UndoRedoPlugin extends BaseGridPlugin {
  static readonly dependencies: PluginDependency[] = [
    { name: 'editing', required: true },
  ];
}
```

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `name` | <code>string</code> | The name of the required plugin (matches the plugin's `name` property). Use string names for loose coupling - avoids static imports. |
| `required?` | <code>boolean</code> | Whether this dependency is required (hard) or optional (soft). - `true`: Plugin cannot function without it. Throws error if missing. - `false`: Plugin works with reduced functionality. Silent if missing   (set severity to `'warn'` or `'info'` to opt into a message). |
| `severity?` | <code>error &#124; warn &#124; info</code> | Explicit severity when this dependency is missing. Overrides the default derived from required. - `'error'`: throw (halts grid setup). Default when `required` is not `false`. - `'warn'`: log a console warning and continue (development only). - `'info'`: log a verbose console.debug message and continue (development only). <span class="since-badge" title="Introduced in v2.16.0">v2.16.0+</span> |
| `when?` | <code>(pluginConfig: unknown) =&gt; boolean</code> | Optional predicate that gates whether this dependency applies, evaluated against the depending plugin's own resolved configuration (defaults merged with user config). Return `false` to skip the dependency entirely. <span class="since-badge" title="Introduced in v2.16.0">v2.16.0+</span> |
| `reason?` | <code>string</code> | Human-readable reason for this dependency. Shown in error/info messages to help users understand why. |

### Property Details

#### required

**Default:** `true`

---

#### when

Optional predicate that gates whether this dependency applies, evaluated
against the depending plugin's own resolved configuration (defaults merged
with user config). Return `false` to skip the dependency entirely.

Lets a plugin require/recommend another plugin only under certain config
— e.g. a plugin that needs a tool-panel host only when its tool panel is
enabled. When omitted, the dependency always applies.

```ts
when: (cfg: PivotConfig) => cfg.showToolPanel === true
```

---

#### reason

```ts
"UndoRedoPlugin needs EditingPlugin to track cell edits"
```

---
