GitHub

FileViewerPreview

The one-line routed preview shell for embedding a single file.

FileViewerPreview is the compact File Viewer entry point. It creates the provider, frame, inset, viewport, and routed document for a single file.

<FileViewerPreview source={source} className="h-full" />

Behavior

  • Renders FileViewerProvider, FileViewer, FileViewerInset, FileViewerViewport, and FileViewerDocument for you.
  • Uses FileViewerDocument controls so renderer controls stay inside the routed document instead of requiring header controls.
  • Does not render FileViewerHeader or FileViewerSidebar. Use the composed anatomy when you need a header, navigation rail, or workflow chrome.
  • Is the right leaf for nested attachment previews where a parent viewer already owns the surrounding surface.

API Reference

PropTypeDescription
sourceViewerSourceThe file source. Required.
categoryFileCategoryForce a renderer category instead of detecting it.
fallbackFrameSize{ width; height }Initial frame size for image-like fallbacks.
fallbackSlideSize{ width; height }Initial slide size for presentation fallbacks.
isolateStylesbooleanScope document styles where supported.
classNamestringClass on the preview frame.

Source

file-viewer-preview.tsx