GitHub

FileViewerSidebar

The optional file-scoped rail beside the file inset.

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 by FileViewerProvider and passed through the surrounding FileViewer; toggle it with FileViewerSidebarTrigger.
  • 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.
  • width and side set the rail shell; whether it renders inline or as an overlay is resolved from the surrounding FileViewer's sidebarMode/inlineBreakpoint and available width.
  • Always pass aria-label — the rail is a landmark and needs an accessible name.

API Reference

PropTypeDescription
aria-labelstringAccessible name for the navigation rail. Recommended.
widthstringRail 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.
...propsReact.ComponentProps<"aside">Standard aside props; className is forwarded.

Source

file-viewer.tsx