# Captured Document Viewer

Read the captured document and source evidence used to generate a table.

## Add it to an app

1. Open the app builder and find **Captured Document Viewer** in the component palette.
2. Insert it into the intended region or container.
3. Set its properties in the inspector. Use a literal for a fixed value or a binding for a value supplied by the app.
4. Connect its events where the app should respond to a user gesture.
5. Preview with representative data and save after resolving validation problems.

The type name in the builder’s code view is `retained_document_viewer`.

## Settings

| Setting | Accepted value | Required | Default | What it controls |
| --- | --- | --- | --- | --- |
| Show close button (`closable`) | boolean | No | true | The listed default is inserted when adding a new component. |
| Captured evidence or saved table cell (`evidence`) | object or null | No | null | Supports expression bindings. A review's activeEvidence, or a grid's selectedTableCell to resolve. The listed default is inserted when adding a new component. |
| Open viewer (`open`) | boolean | No | true | Supports expression bindings. The listed default is inserted when adding a new component. |
| Detail visibility app-state key (literal) (`openKey`) | string | No | Not specified | Literal only; do not use an expression binding. |
| Detail width (literal) (`split`) | "half" / "third" | No | Not specified | Literal only; do not use an expression binding. |

## Values available to bindings

| Value | Type | Initial value | Meaning |
| --- | --- | --- | --- |
| `status` | "idle" / "loading" / "available" / "ready" / "unsupported" / "error" | null | Read state of the captured document. |

Refer to these values through `components.<component-id>.<value>` in a binding. Use the identifier assigned to this instance of Captured Document Viewer, not the component type name.

## Events

- `onClose` — The viewer was closed.

Connect only the actions the app needs. An event can fetch results, run an enabled data source, set state, update another component, show a notification, or navigate where supported.

## Keyboard and accessible labels

Accessible label source: Captured document.

- ArrowLeft/ArrowRight/Home/End move between the view tabs

## Example: Detail pane that follows the selected evidence

| Setting | Example value |
| --- | --- |
| `evidence` | "{{ app.activeEvidence }}" |
| `open` | "{{ app.viewerOpen }}" |
| `openKey` | "viewerOpen" |

When `onClose` occurs, the example performs:

- `setStateValue` with {"key":"viewerOpen","value":false}

## Example: Always-open evidence pane, even split

| Setting | Example value |
| --- | --- |
| `closable` | false |
| `evidence` | "{{ app.activeEvidence }}" |
| `split` | "half" |

## If it is empty or unavailable

Check the source binding, the selected item, and the app’s access. A hosted document, table, review, or storage component needs the corresponding app capability; an offline preview cannot supply live private data. A source running with no results is different from an invalid binding. Inspect the app’s workflow and data source before changing the presentation.
