Sections
File Viewer
- Overview
- Anatomy
- Header
- Navigation
- Renderers
FileViewerSidebar is the spatial slot for file navigation. It owns the rail
shell: width, side override, collapse behavior, and the accessible rail label.
<FileViewerSidebar aria-label="Document sections" width="18rem">
<SegmentSidebar
segments={segments}
interaction={interaction}
currentPage={currentPage}
/>
</FileViewerSidebar>Behavior
- Renders a
data-slot="file-viewer-sidebar"rail. Open/collapsed state is owned byFileViewerProviderand passed through the surroundingFileViewer; toggle it withFileViewerSidebarTrigger. - The content owns row semantics; the sidebar only owns where the rail lives and how it opens. Drop in any navigation: thumbnails, attachments, segments, or source fields.
widthandsideset the rail shell; whether it renders inline or as an overlay is resolved from the surroundingFileViewer'ssidebarMode/inlineBreakpointand available width.- Always pass
aria-label— the rail is a landmark and needs an accessible name.
API Reference
| Prop | Type | Description |
|---|---|---|
aria-label | string | Accessible name for the navigation rail. Recommended. |
width | string | Rail width (e.g. "18rem"). Sets the --viewer-sidebar-width. |
side | "left" | "right" | Which side the sidebar mounts on. Defaults to "left". |
collapsible | "offcanvas" | "none" | Whether the rail can collapse off-canvas. |
...props | React.ComponentProps<"aside"> | Standard aside 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,