Sections
File Viewer
- Overview
- Anatomy
- Header
- Navigation
- Renderers
FileViewerViewport is the scroll and clipping boundary for routed documents.
It must live inside FileViewerInset, and FileViewerDocument must live inside
it.
<FileViewerInset>
<FileViewerViewport>
<FileViewerDocument />
</FileViewerViewport>
</FileViewerInset>Behavior
- Renders a
data-slot="file-viewer-viewport"element. - Defines the scroll and clipping boundary that routed documents render inside.
- Keeps animated width out of React measurement; document sizing comes from the FileViewer document-frame contract.
- Throws in development when it is rendered outside
FileViewerInset. - Renderer internals use the frame contract for deterministic document sizing; app composition should treat the viewport as an anatomy boundary.
API Reference
| Prop | Type | Description |
|---|---|---|
children | React.ReactNode | Usually FileViewerDocument. |
...props | React.ComponentProps<"div"> | Standard viewport props; className is merged. |
Source
file-viewer-layout.tsx
"use client";
import * as React from "react";
import { cn } from "@/lib/utils";
import {
useOptionalFileViewerShellStatic,
useFileViewerShellStatic,
} from "./file-viewer-context";
import {
FileViewerDocumentFrameProvider,