Sections
File Viewer
- Overview
- Anatomy
- Header
- Navigation
- Renderers
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
FileViewerDocumentor provider-bound renderer parts inFileViewerViewport. - 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
| Prop | Type | Description |
|---|---|---|
children | React.ReactNode | The document viewport and optional local chrome. |
align | "start" | "center" | "end" | Alignment for the document frame. |
maxInlineSize | React.CSSProperties["maxInlineSize"] | Optional max inline size for the document frame. |
documentFrameClassName | string | Class name for the internal document frame. |
documentFrameStyle | React.CSSProperties | Style for the internal document frame. |
...props | React.ComponentProps<"div"> | Standard inset props; className is forwarded. |
Source
file-viewer.tsx
"use client";
export type { ViewerSource } from "./file-viewer-core";
export {
FileViewerContent,
FileViewerInset,
FileViewerLegend,
FileViewerViewport,
type FileViewerContentProps,
type FileViewerInsetProps,
type FileViewerLegendProps,
type FileViewerViewportProps,