- PDF Viewer
- PDF Toolbar
- PDF More Actions Menu
- PDF Floating Toolbar
- PDF Document Tabs
- PDF View
- PDF Document Grid
- PDF Document Info
- PDF Page Navigation
- PDF Zoom Controls
- PDF Undo/Redo Buttons
- PDF Keyboard Shortcuts
- PDF Bookmark Sidebar
- PDF Thumbnail Sidebar
- PDF Search Panel
- PDF Attachment List
- PDF Annotation Layer
- PDF Annotation Toolbar
- PDF Annotation Inspector
- PDF Annotation Selection Menu
- PDF Annotation Sidebar
- PDF Comment
- PDF Comment Draft
- PDF Comment Button
- PDF Comment Sidebar
- PDF Redaction Toolbar
- PDF Capture Button
- PDF Form Fill Toggle
- PDF Signature Button
- PDF Stamp Button
A definition list of a document's PDF properties, sourced straight from the engine.
About#
<PdfDocumentInfo /> lists a document's PDF properties — file name, title,
author, subject, keywords, dates, creator, producer, and page count — read
straight from the engine's getMetadata() and the loaded document. It's the
shared body of both the document properties dialog and the
library browser block's information sidebar, so the
two never drift apart.
- Follows the viewer — with no props it describes the ambient viewer
document (the focused view's active document), so it tracks whatever the
viewer is showing. Pass
documentIdto pin it to a specific document. - Grouped, not listed — properties sit in four ruled sections (File,
Description, Origin, Format) with a fixed label column, laid out
like
<PdfAnnotationInspector />because it's the same kind of surface. Thirteen flat rows are read; four labelled groups are scanned. - Honest fallbacks — file size, PDF version, and Fast Web View aren't
tracked once a document is open, so those render
N/A, matching PDFSlick's own fallback for the fields it can't populate either. Empty metadata fields render an em dash.
The render and document-manager plugins that source this all ship inside
<PdfViewer> already, so the panel needs no extra plugin registration.
Installation#
pnpm dlx shadcn@latest add pdfcn/document-info
Usage#
Place <PdfDocumentInfo> inside a <PdfViewer>. With no props it describes
the document the viewer is showing.
<PdfViewer documents={[{ url: "/sample.pdf" }]} className="h-[720px]">
<div className="flex h-full min-h-0">
<PdfViewerContent />
<aside className="w-80 border-l p-4">
<PdfDocumentInfo />
</aside>
</div>
</PdfViewer>The component brings no horizontal padding of its own, so the section rules run
to the edges of whatever it's dropped into. Both of its own hosts — the
properties dialog and the library browser's sidebar — pad already; a bare panel
should pass px-4.
Examples#
In a dialog#
<PdfDocumentPropertiesDialog />
is this panel in a dialog, with a trigger already wired. Reach for it before
building the same thing:
<PdfToolbar>
<PdfPageNavigation />
<div className="ml-auto flex items-center gap-1">
<PdfDocumentPropertiesDialog />
</div>
</PdfToolbar>Describing a document other than the open one#
documentId pins the panel to one document, which is how a browsing layout
inspects a card without opening it. The library browser
does exactly this — a grid of documents beside a sidebar describing the selected
one:
<aside className="w-80 border-l px-4 py-2">
<PdfDocumentInfo documentId={selectedId} />
</aside>Every open document has plugin state whether or not it's the one on screen, so the panel resolves without the document being visible anywhere.
Accessibility#
Each property is a <dt>/<dd> pair inside a <dl>, one <dl> per section, so
a screen reader reads a label with its value rather than a row of loose text.
Sections are <section> elements with their own heading, making the four groups
navigable as landmarks.
Values truncate visually but carry their full text on title, so nothing is lost
to the fixed label column. While the metadata resolves, the panel renders a
skeleton shaped like the sections it stands in for — the layout doesn't shift
when the values arrive.
API Reference#
PdfDocumentInfo#
A <div> carrying data-slot="pdf-document-info". Accepts every prop a <div>
takes, plus:
| Prop | Type | Default | Description |
|---|---|---|---|
documentId | string | null | ambient document | The document to describe. Defaults to the focused view's active document; pass an id to pin it to a specific one. |
Styling the sections#
| Slot | Element | Description |
|---|---|---|
pdf-document-info | div | The root. Sets the 12px panel tier every row inherits. |
pdf-document-info-list | div | The four sections, once the metadata has resolved. |
pdf-document-info-section | section | One labelled group. A <dl> per section, ruled off from the next. |
pdf-document-info-skeleton | div | The loading state, shaped like the sections it stands in for. |
Each row is a <dt>/<dd> pair on one line, the label column fixed wide enough
for the longest label the panel owns so values line up down the whole panel
rather than stepping in and out section by section. Values truncate with the
full text on title.