GitHub

FileViewerInset

The geometry-aware content inset beside an optional sidebar.

FileViewerInset is the primary content slot inside FileViewerContent. It is the sibling of FileViewerSidebar and owns the geometry contract between sidebar motion and document rendering.

<FileViewerInset>
  <FileViewerViewport>
    <FileViewerDocument />
  </FileViewerViewport>
</FileViewerInset>

It can also host a renderer's own document instead of the routed document — for example a provider-bound PDF page list:

<FileViewerInset>
  <FileViewerViewport>
    <PdfViewerPages />
  </FileViewerViewport>
</FileViewerInset>

Behavior

  • Renders a data-slot="file-viewer-inset" region that takes the space beside the sidebar.
  • Renders the internal data-slot="file-viewer-document-frame" boundary used for alignment, max inline size, and renderer layout.
  • Provides the document-frame contract used by fit-to-width renderers while inline sidebars open and close. The contract exposes active, settled, and prepared inline sizes plus the shell transition duration.
  • Wrap FileViewerDocument or provider-bound renderer parts in FileViewerViewport.
  • It does not read the file source. The routed document or renderer part owns rendering.
  • Use it for routed documents and paginated renderers instead of composing a raw surface manually.

API Reference

PropTypeDescription
childrenReact.ReactNodeThe document viewport and optional local chrome.
align"start" | "center" | "end"Alignment for the document frame.
maxInlineSizeReact.CSSProperties["maxInlineSize"]Optional max inline size for the document frame.
documentFrameClassNamestringClass name for the internal document frame.
documentFrameStyleReact.CSSPropertiesStyle for the internal document frame.
...propsReact.ComponentProps<"div">Standard inset props; className is forwarded.

Source

file-viewer.tsx