Sections
File Viewer
- Overview
- Anatomy
- Header
- Navigation
- Renderers
FileViewerSidebarHeader, FileViewerSidebarContent,
FileViewerSidebarFooter, and the sidebar section primitives give a sidebar a
consistent internal layout. They do not define row semantics; domain components
such as SegmentSidebar or AttachmentSidebar own those.
<FileViewerSidebar aria-label="Document navigation">
<FileViewerSidebarHeader>Pages</FileViewerSidebarHeader>
<FileViewerSidebarContent>
<FileViewerSidebarSection>
<FileViewerSidebarSectionHeader>
<FileViewerSidebarSectionTitle>Pages</FileViewerSidebarSectionTitle>
<FileViewerSidebarSectionAction aria-label="Refresh pages" />
</FileViewerSidebarSectionHeader>
<FileViewerSidebarSectionContent>
<FileViewerThumbnails />
</FileViewerSidebarSectionContent>
</FileViewerSidebarSection>
</FileViewerSidebarContent>
<FileViewerSidebarFooter>400 pages</FileViewerSidebarFooter>
</FileViewerSidebar>Components
| Component | Use For |
|---|---|
FileViewerSidebarHeader | Fixed rail header. |
FileViewerSidebarContent | Scrollable rail body. |
FileViewerSidebarFooter | Fixed rail footer. |
FileViewerSidebarSection | Padded semantic section. |
FileViewerSidebarSectionHeader | Section title/action row. |
FileViewerSidebarSectionTitle | Truncating section title. |
FileViewerSidebarSectionAction | Small icon action inside the section header. |
FileViewerSidebarSectionContent | Section body for rows, thumbnails, or fields. |
FileViewerSidebarSeparator | Rail separator with File Viewer spacing. |
Behavior
- These primitives render stable
data-slot="file-viewer-sidebar-*"attributes for styling and tests. FileViewerSidebarSectionActionsupportsasChildfor custom button-like controls.- Use these when creating a new rail grammar. Use
SidebarList*when the rail needs menu-like grouped rows.
Source
file-viewer-sidebar.tsx
"use client";
import * as React from "react";
import { Slot } from "radix-ui";
import { cn } from "@/lib/utils";
import {
DEFAULT_FILE_VIEWER_SIDEBAR_WIDTH,
type FileViewerSidebarCollapsible,
type FileViewerSidebarSide,
useFileViewerShell,