GitHub

FileViewerHeader

The full-width file row for title, passive metadata, sidebar trigger, and active renderer controls.

FileViewerHeader is the top row of a composed file viewer. It is intentionally file-type agnostic: PDF, image, spreadsheet, text, and email renderers all register their operational controls into the same header surface.

spacex-prospectus.pdf

Usage

Compose the header explicitly, with the sidebar trigger in the start group when FileViewerContent has a sidebar:

<FileViewerHeader>
  <FileViewerSidebarTrigger />
  <div className="flex min-w-0 flex-1 items-baseline gap-2">
    <FileViewerTitle />
    <FileViewerMeta />
  </div>
  <FileViewerControls />
</FileViewerHeader>

Rendered without children, FileViewerHeader falls back to the default title/meta/controls composition:

<FileViewerHeader />

Behavior

  • Renders a data-slot="file-viewer-header" row with a flex layout that wraps on narrow widths and lines up on wider ones.
  • With no children, it renders FileViewerTitle and FileViewerMeta on the left and FileViewerControls on the right, so the common case needs no inner markup.
  • It owns layout only. Renderer-specific controls register into file-viewer state and surface through FileViewerControls; the header never takes PDF- or spreadsheet-specific props.
  • Use it for file identity and controls. Keep domain workflow state out of the header unless the file viewer itself owns it.

API Reference

PropTypeDescription
childrenReact.ReactNodeHeader parts. Omit to use the default title/meta/controls row.
...propsReact.ComponentProps<typeof ViewerHeader>Standard header props; className merges with the layout.

Source

file-viewer.tsx