packages/desktop/apps/electron/resources/docs/image-preview.md
This guide covers how to display image files inline using image-preview code blocks.
The image-preview block renders local image files inline in chat messages — showing the image in a fixed-height container with an expand button for fullscreen viewing.
| Format | Best For | Rendering |
|---|---|---|
image-preview block | Screenshots, captures, visual diffs | Inline fit-to-container + fullscreen viewer |
pdf-preview block | PDF reports and documents | First page inline + full navigation |
html-preview block | Rich HTML content | Sandboxed iframe rendering |
Key principle: Images are already files on disk. Reference them directly with an absolute path in src.
Use image-preview when:
Do NOT use image-preview when:
pdf-preview)html-preview)datatable/spreadsheet)```image-preview
{
"src": "/absolute/path/to/screenshot.png",
"title": "Settings screen"
}
```
Use items to show related images with tab navigation.
```image-preview
{
"title": "Before / After",
"items": [
{ "src": "/path/to/before.png", "label": "Before" },
{ "src": "/path/to/after.png", "label": "After" }
]
}
```
Content loads lazily on tab switch and is cached once loaded.
| Field | Required | Type | Description |
|---|---|---|---|
src | Yes* | string | Absolute path to image file (single item mode) |
title | No | string | Header title (defaults to "Image Preview") |
items | Yes* | array | Array of image items with src and optional label |
items[].src | Yes | string | Absolute path to image file |
items[].label | No | string | Tab label |
*Either src (single) or items (multiple) is required. If both are present, items takes precedence.
In-app preview supports Chromium-decodable formats:
Formats like HEIC/HEIF/TIFF may not render in-app. For those files, use external open.
object-contain (no cropping)src is an absolute path