Skip to content

Start here

Document Viewer

Reading pane with in-document search, citation anchors, original-PDF view, and export.

Reading pane with in-document search, citation anchors, original-PDF view, and export.

Add it to an app

  1. Open the app builder and find 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 document_viewer.

Settings

SettingAccepted valueRequiredDefaultWhat it controls
Provenance anchor (anchor)object or nullNonullSupports expression bindings. The active citation to land on (a grid's activeCitation via app state); null = none. The listed default is inserted when adding a new component.
Show close button (closable)booleanNofalseSupports expression bindings. The listed default is inserted when adding a new component.
Allow editing (needs versions capability) (editable)booleanNofalseSupports expression bindings. The listed default is inserted when adding a new component.
Export file name (exportName)stringNo""Supports expression bindings. The listed default is inserted when adding a new component.
Document title (fileName)stringNo""Supports expression bindings. The listed default is inserted when adding a new component.
Viewer height (CSS length) (height)stringNo"32rem"Supports expression bindings. The listed default is inserted when adding a new component.
Index record type (indexRecordType)stringNo"search_index"The listed default is inserted when adding a new component.
Search index data source id (indexSource)stringNo""The listed default is inserted when adding a new component.
View mode (auto | original | text) (mode)"auto" / "original" / "text"No"auto"Supports expression bindings. Choose read to return query results or write to insert incoming records. The listed default is inserted when adding a new component.
Document object key (objectKey)stringNo""Supports expression bindings. The listed default is inserted when adding a new component.
Detail visibility app-state key (literal) (openKey)stringNoNot specifiedLiteral only; do not use an expression binding.
Refresh token (refreshToken)string or nullNoNot specifiedSupports expression bindings. A new non-empty value reloads the document from page 1.
Segment record type (blank = from index manifest) (segmentRecordType)stringNo""The listed default is inserted when adding a new component.
Segments data source id (segmentsSource)stringNo""The listed default is inserted when adding a new component.
Show find bar (showSearch)booleanNotrueSupports expression bindings. The listed default is inserted when adding a new component.
Detail width ('half' = even split; default 'third' = 2:1 — literal) (split)"half" / "third"NoNot specifiedLiteral only; do not use an expression binding.

Values available to bindings

ValueTypeInitial valueMeaning
activeMatchinteger0Position of the active match.
activeVersioninteger or nullnullThe version on display; null = current.
anchorStatus"none" / "painted" / "approximate" / "page" / "document" / "unpaintable""none"The landing the reader actually got for the anchor.
editStatus"idle" / "editing" / "saving" / "conflict" / "error""idle"The edit lifecycle.
exportStatus"idle" / "exporting" / "done" / "empty" / "error""idle"The last export's outcome (the host's verdict).
lastSavedIngestIdstring or nullnullThe last save's re-index correlation id (watch it like an upload's).
lastSavedVersioninteger or nullnullThe last save's version.
matchCountinteger0Matches the index reports.
matchCountExactbooleantrueThe two counts agree.
navigableMatchesinteger0Matches the reader can step through.
segmentsLoadedinteger0Segments loaded so far.
segmentsTotalinteger or nullnullAdvisory segment total.
status"idle" / "unavailable" / "loading" / "error" / "ready" / "empty""idle"Read state of the document.
termslist of string[]The search terms in play.
valuestring""The find query.

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

Events

  • onClose — The close button was pressed.

  • onExport — An export downloaded (after the host sink succeeded).

  • onMatchChange — The active match moved.

  • onSearch — The find query ran.

  • onVersionChange — Another version was put on display.

  • onVersionSaved — An edit was saved as a new version.

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: Document viewer.

  • Escape clears the find query, else closes a closable viewer
SettingExample value
closabletrue
indexSource"search"
objectKey"{{ app.activeDocKey || '' }}"
openKey"viewerOpen"
segmentsSource"segments"

When onClose occurs, the example performs:

  • setStateValue with {"key":"viewerOpen","value":false}

Example: Citation target: lands anchors, editable, even split

SettingExample value
anchor"{{ app.activeAnchor }}"
editabletrue
indexSource"search"
objectKey"{{ app.activeAnchor ? app.activeAnchor.object_key : '' }}"
segmentsSource"segments"
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.