Sections
File Viewer
- Overview
- Anatomy
- Header
- Navigation
- Renderers
FileViewerControls renders controls registered by the active renderer: page or
slide position, zoom, rotate, loading state, downloads, and extra actions.
<FileViewerControls extra={<ApproveButton />} />Behavior
- Reads registered controls from file viewer context. The header stays file-type agnostic.
- Falls back to the original file download action when the active renderer has not registered its own downloads.
- Allows workflow actions through
extra; this is merged with any renderer-registeredextra. - Renders
data-slot="file-viewer-controls"anddata-file-viewer-controls="ready"when a renderer has registered controls. - Does not render file identity. Use
FileViewerTitlefor the file name andFileViewerMetafor passive metadata.
API Reference
| Prop | Type | Description |
|---|---|---|
extra | React.ReactNode | File-scoped actions beside renderer controls. |
...props | ViewerControls props except registered state | Standard controls props; className is merged. |
Source
file-viewer-header.tsx
"use client";
import * as React from "react";
import { PanelLeft, PanelRight } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "./button";
import { Spinner } from "./spinner";
import { useFileViewerControlsState } from "./file-viewer-provider";
import { useFileViewerRequiredResourceState } from "./file-viewer-resource-state";
import {