Documents Table
Display documents in a paginated table format with configurable columns for name, modified date, author, size, and type.
Get Documents Table Working in 3 Steps
Prerequisites
- Bonzai 2 package installed on your site
- A document library with files
Add the web part
Edit your page and add "Bonzai Documents Table" from the Bonzai category.
Select a site and library
Choose a Site Selection Mode (picker or manual URL), then pick your document library from the List picker.
Configure columns
Pick visible columns via the "Visible Columns" multi-select (Name, Modified Date, Created Date, Author, File Size, File Type) and set items per page.
When to Use This Web Part
Use this when you need to...
- Display documents in a structured table
- Show metadata columns (author, modified, size, type)
- Create a file browser experience
- Provide a compact document listing
Best page locations
- Document library pages — structured browsing
- Admin pages — file management
- Archive pages — historical documents
- Knowledge base pages — organized files
Consider alternatives when...
- • Visual document display — use Documents Rollup
- • Full search — use Document Portal
- • Card-based layouts — use Documents Rollup
Related web parts:
Recent Updates
- New: Site Selection Mode — pick between a Microsoft Graph site picker or a manual URL for cross-site libraries.
- New: Visible Columns multi-select — replaces the legacy per-column toggles with a single control and adds a Created Date option.
- New: Additional Library Columns — discovers non-hidden columns from the selected document library so you can surface custom fields alongside the built-ins.
- Interactive column sorting — clicking any header toggles ascending/descending; the server re-queries with the new order.
- Automatic file type icons — Word, Excel, PowerPoint, OneNote, Visio, Project, PDF, text, image, video, audio, archive, and code extensions render with matching Fluent UI icons.
- Server-backed paging — uses SharePoint
@odata.nextLinkwith per-page caching for fast navigation. - Promoted field auto-discovery — detects
Promoted,Featured,Featured_x003f_, orPromotedStatein the target library. - Progressive field fallback — the service tries multiple field combinations (including
File_x0020_SizevsFileSizeDisplay) so libraries with non-standard schemas still render. - Legacy
showName,showModified,showAuthor,showSize,showTypetoggles are still honored, butvisibleColumnstakes precedence when set.
Common Configurations
Copy these ready-to-use configurations:
Full Document Table
All columns visible with pagination
| title | Documents |
| showName | On |
| showModified | On |
| showAuthor | On |
| showSize | On |
| showType | On |
| itemsPerPage | 20 |
Compact File List
Name and modified date only
| title | Recent Files |
| showName | On |
| showModified | On |
| showAuthor | Off |
| showSize | Off |
| itemsPerPage | 10 |
Admin File View
Size and type for file management
| title | File Manager |
| sortBy | size |
| showName | On |
| showSize | On |
| showType | On |
| itemsPerPage | 25 |
Best Practices
Choose relevant columns
Set reasonable page size
Use Show More link
Interactive Features
Sortable column headers
Every visible column header is clickable. Clicking a header re-queries the server with the new sort (and toggles direction if the same column is clicked again). The initial sort comes from the sortBy property — name defaults to ascending, all other columns default to descending.
Clickable file names
The Name column renders the file name as a link that opens the document in a new tab (target="_blank", data-interception="off" so SharePoint does not intercept the navigation). No row-click handler is attached — only the file-name link is interactive.
File type icons
The service maps a document's extension to a Fluent UI icon. Unrecognized extensions fall back to the generic Document icon.
| Category | Extensions | Icon |
|---|---|---|
| Word | doc, docx, docm | WordDocument |
| Excel | xls, xlsx, xlsm, csv | ExcelDocument |
| PowerPoint | ppt, pptx, pptm | PowerPointDocument |
| OneNote | one | OneNoteLogo |
| Visio | vsd, vsdx | VisioDocument |
| Project | mpp | ProjectDocument |
PDF | ||
| Text | txt, rtf, log | TextDocument |
| Images | jpg, jpeg, png, gif, bmp, svg | FileImage |
| Video | mp4, avi, mov, wmv | Video |
| Audio | mp3, wav | MusicInCollection |
| Archives | zip, rar, 7z | ZipFolder |
| Code | html, css, js, ts, json, xml | FileCode |
| Default | any other extension | Document |
Server-backed pagination
Pagination uses SharePoint's @odata.nextLink so each page is fetched on demand. Visited pages are cached in memory for the lifetime of the component, so clicking back to a previous page is instant. The total count shown in the pagination bar comes from the list'sItemCount metadata and is only displayed when promoted filtering is off (filtered queries fall back to a simple {from}-{to} indicator).
Reference
Document Library Schema
Documents Table uses standard document library fields. No custom columns are required, but you can add a promoted-state column to support promoted filtering. The service auto-discovers the promoted field by scanning the library's column list for known names.
- Select an existing document library with files.
- Optional: add one of Promoted, Featured, or PromotedState for promoted filtering.
- Ensure documents are published and accessible to viewers.
| Column | Type | Required | Notes |
|---|---|---|---|
| Title | Single line of text | No | Default library field; falls back to file name without extension |
| FileLeafRef | Single line of text | Yes | File name (built-in) — used for the Name column and name sort |
| FileRef | Hyperlink | Yes | Server-relative path (built-in) — resolved to an absolute URL for the file link |
| Modified | Date/Time | Yes | Used for Modified column and default sort |
| Created | Date/Time | No | Used when the created column is visible or sortBy = created |
| File_x0020_Size | Number | No | Preferred size field; service falls back to FileSizeDisplay when unavailable |
| Author | Person | No | Creator display name (expanded via $expand=Author) |
| Promoted / Featured / Featured_x003f_ / PromotedState | Yes/No or Number | No | Promoted-item filter. The service checks these internal names in order and uses the first one it finds (matches values 1, true, or 'Yes') |
Property Pane Configuration
Title Settings
| Property | Type | Description |
|---|---|---|
title | Text | Web part title displayed above the table |
titleUrl | Text | Optional URL to make the title clickable |
titleIconOption | Dropdown | Title icon mode: Custom or None |
titleIconName | Icon Picker | Fluent UI icon picker (e.g., Table) |
titleIconUrl | Text | Custom icon URL (overrides icon name) |
description | Text (Multiline) | Optional description below the title |
showMoreText | Text | Text for the footer link |
showMoreUrl | Text | URL for the footer link |
Data Source Settings
| Property | Type | Default | Description |
|---|---|---|---|
siteSelectionMode | Dropdown | manual | Choose how to pick the source site: picker (dropdown of sites discovered via Microsoft Graph) or manual (type a URL) |
selectedSiteUrl | Dropdown | — | Selected site URL when siteSelectionMode = picker; populated from Graph (/sites?search=*, up to 500 sites, sorted by display name) |
siteUrl | Text | — | Manual site URL when siteSelectionMode = manual. Empty = current site |
listName | List Picker | — | Document library to display (filtered to base template 101). Stores list title and GUID so renames stay resolvable |
sortBy | Dropdown | modified | Default sort column: name, modified, created, or size (users can re-sort by clicking headers at runtime) |
showPromotedItems | Toggle | Off | Show only promoted/featured documents (auto-discovers the promoted field; see schema section below) |
Site picker uses Microsoft Graph
siteSelectionMode is set to picker, the web part calls the Microsoft Graph /sites endpoint on property pane open. If the Graph call fails (for example, due to permissions), the current site is offered as a fallback so the dropdown is never empty.Column Visibility
The Column Visibility group has two multi-selects. visibleColumns picks which built-in columns to render; dynamicColumns lets you surface custom columns discovered from the selected document library.
| Property | Type | Default | Description |
|---|---|---|---|
visibleColumns | Multi-select | ["name", "modified", "author", "size"] | Built-in columns to render. Options: name, modified, created, author, size, type. When set (non-empty), this property fully replaces the legacy show* toggles |
dynamicColumns | Multi-select | [] | Additional library columns to include. Populated from the selected library's non-hidden fields via the SharePoint REST /fields endpoint |
Built-in column options:
| Key | Header | Sorted by | Rendering |
|---|---|---|---|
name | Name | FileLeafRef | File type icon + file name as a link that opens in a new tab |
modified | Modified | Modified | Localized short date (e.g., Apr 21, 2026) |
created | Created | Created | Localized short date |
author | Author | Modified (fallback) | Plain text (falls back to Unknown if unavailable). Header is clickable but the service does not map author to a server sort field, so the query falls back to Modified |
size | Size | File_x0020_Size | Human-readable size (B/KB/MB/GB/TB, 1 decimal) |
type | Type | Modified (fallback) | Uppercase file extension. Header is clickable but the service does not map type to a server sort field, so the query falls back to Modified |
Legacy Column Toggles
These boolean properties predate visibleColumns. They are still wired up for backward compatibility — existing configurations keep working — but the multi-select above is preferred for new deployments. When visibleColumns is a non-empty array, the toggles below are ignored.
| Property | Type | Default | Description |
|---|---|---|---|
showName | Toggle | On | Show the document name column |
showModified | Toggle | On | Show the modified date column |
showAuthor | Toggle | On | Show the author column |
showSize | Toggle | On | Show the file size column |
showType | Toggle | Off | Show the file type column |
Created column only via multi-select
visibleColumns multi-select — there is no legacy showCreated toggle. Configurations that still rely onshow* toggles will not render a Created column.Display Settings
| Property | Type | Description |
|---|---|---|
itemsPerPage | Slider (5-50) | Number of documents to display per page |
showPaging | Toggle | Show pagination controls |
showTableHeaders | Toggle | Show column headers in the table |
fixedHeight | Slider (0-800) | Fixed height in pixels (0 = auto height) |
chromeType | Dropdown | Chrome type: None, Title Only, Border Only, Title and Border |
Features Checklist
- ✅ Tabular document display via Fluent UI
DetailsList - ✅ Built-in columns: Name, Modified, Created, Author, Size, Type
- ✅ Multi-select column visibility (
visibleColumns) with legacy toggle fallback - ✅ Dynamic library columns discovered via REST
/fields - ✅ Click-to-sort column headers (server-backed)
- ✅ Default sort options: Name, Modified, Created, Size
- ✅ Server-backed pagination via
@odata.nextLinkwith per-page caching - ✅ Show table headers toggle
- ✅ Promoted items support with auto-discovered field (
Promoted,Featured,Featured_x003f_,PromotedState) - ✅ Cross-site data source (manual URL or Microsoft Graph site picker)
- ✅ Custom title with Fluent icon, custom icon URL, or no icon
- ✅ Chrome types: None, Title Only, Border Only, Title and Border
- ✅ Show More link
- ✅ Fixed height option (0-800px)
- ✅ Automatic file type icons (~30 extensions)
- ✅ Clickable file names (open in new tab)
- ✅ Progressive field fallback for non-standard schemas
- ✅ License gating via
LicenseWrapper