# Side panels

Add your own panel at the right of the editor, with the current session and slide drawings.

The `panels` option adds buttons to the editor's right toolbar; each opens a panel beside the slide. The AI assistant is added this way, and the host can add its own panels, such as an asset library or an approval log.

```ts
import { Editor, type PptxEditorPanel } from '@quirekit/pptx-editor'

const outline: PptxEditorPanel = {
  id: 'my-app.outline',
  label: 'Outline',
  mount(context) {
    const element = document.createElement('div')
    const render = async () => {
      element.textContent = `${context.session.name()} · ${context.session.selection().length} selected`
    }
    const stop = context.session.subscribe(() => void render())
    void render()
    return { element, destroy: stop }
  },
}

new Editor({ panels: [outline] }).mount('#app')
```

- `mount` runs the first time the panel opens; its content stays for the life of the editor and is not rebuilt when the panel reopens.
- `context.session` is the current session; `context.renderSlide(part)` returns the editor's SVG drawing of a slide and `context.pictureSlide(part, width)` returns PNG bytes, for thumbnails or exports.
- `context.close()` closes the panel. `layouts` declares the layouts the panel supports (`side`, `wide`, and `page`, which takes the main area with the slide previewed beside it); the panel switches with `context.setLayout()`.
- `icon` sets the toolbar button icon and `defaultOpen: true` opens the panel when the editor mounts.
