# ToolPanelDefinition

> _Since v0.1.1_

Tool panel definition registered by plugins or consumers.

Register via the shell plugin's `registerToolPanel()` to add panels to the sidebar.
Panels appear as collapsible sections with icons and titles.

#### Example

```typescript
grid.getPluginByName('shell')?.registerToolPanel({
  id: 'filters',
  title: 'Filters',
  icon: '🔍',
  tooltip: 'Filter grid data',
  order: 10, // Lower = appears first
  render: (container) => {
    container.innerHTML = `
      <div class="filter-panel">
        <input type="text" placeholder="Search..." />
      </div>
    `;
    // Return cleanup function
    return () => container.innerHTML = '';
  },
  onClose: () => {
    console.log('Filter panel closed');
  },
});
```

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| <span id="id"></span>`id` | <code>string</code> | Unique panel ID |
| `title?` | <code>string</code> | Panel title shown in the accordion header. <span class="since-badge" title="Introduced in v3.1.0">v3.1.0+</span> |
| <span id="icon"></span>`icon?` | <code>string</code> | Icon for accordion section header (optional, emoji or SVG) |
| <span id="tooltip"></span>`tooltip?` | <code>string</code> | Tooltip for accordion section header |
| <span id="render"></span>`render` | <code>(container: HTMLElement) =&gt; void &#124; () =&gt; void</code> | Panel content factory - called when panel section opens |
| <span id="onclose"></span>`onClose?` | <code>() =&gt; void</code> | Called when panel closes (for cleanup) |
| <span id="order"></span>`order?` | <code>number</code> | Panel order priority (lower = first, default: 100) |

### Property Details

#### `title`

Panel title shown in the accordion header.

Optional — omit it when the panel's rendered content already provides its
own heading. Rendering rules for the `.tbw-accordion-header` row:

- **Title given** — the header row renders as usual (icon + title + chevron).
- **No title, multiple panels registered** — the header row still renders
  (with an empty title span) so the accordion expand/collapse chevron and
  toggle button remain available.
- **No title, single panel** — the entire header row is skipped; the panel
  content is shown directly.

Made optional in 3.1.0 (previously required).

---

## See Also

- [`ShellConfig`](https://toolboxjs.com/grid/plugins/shell/interfaces/shellconfig.md) for shell configuration
