Skip to Content

ContentList

Search, filter, paginate, and act on caller-provided CMS entries.

By default, ContentList searches and filters the supplied entries, then uses the UI DataTable for local sorting and pagination. For server-driven lists, provide remote and one authorized page of results; the caller owns the query, fetching, sorting, and cursor history.

390 × 844

Server-driven pages

The remote controls emit the complete ContentListQuery without filtering or sorting the returned items. Reset the cursor history when the query changes, fetch the first matching page, and set hasPreviousPage and hasNextPage from your cursor state. Keep the query state current when an input changes; debounce the request rather than the controlled input. The optional totalCount must be a server-provided total, not the current page size.

This preview simulates a server with in-memory data. Production code must perform filtering and pagination in the authorized server API and handle stale responses, loading, and errors in the host.

The Fullstack CMS client returns flat CmsApiDocument records. Project each record's schema fields and admin metadata into the CmsEntryListItem presentation shape before passing the page to this component; do not pass page.items directly. Revision/status metadata is present when drafts are enabled, and createdAt/updatedAt are present when timestamps are enabled.

390 × 844

Selection and bulk actions

Pass selection to control selected IDs and configure action buttons. Selection can span pages; “Select this page” affects only the supplied remote page, while local mode selects all matching supplied entries. The caller implements and authorizes each bulk action and returns succeededIds and per-entry failures. Successful IDs are removed from selection, failures remain selected, and omitted IDs are reported as failures. Rejected actions are displayed as errors without clearing selection. Avoid supplying actions the current user is not allowed to invoke.

API

PropTypeRequiredDefault
itemsreadonly CmsEntryListItem[]Yes—
titleReactNodeNo"Content"
contentTypeNamestringNo"entry"
localesreadonly string[]No[]
loading / permissionDeniedbooleanNofalse
errorReactNodeNo—
onCreate() => voidNo—
onEdit / onDuplicate / onArchive(entry: CmsEntryListItem) => voidNo—
remoteContentListRemoteNo—
selectionContentListSelectionNo—
classNamestringNo—

ContentListRemote contains:

PropertyTypePurpose
queryContentListQueryControlled search, status, and locale; use "all" for unfiltered status or locale.
onQueryChange(query: ContentListQuery) => voidUpdate the controlled input state and reset cursor history.
hasPreviousPage / hasNextPagebooleanEnable the corresponding page button.
onPreviousPage / onNextPage() => voidNavigate using the host's cursor history.
totalCountnumberOptional total for the complete server query.

ContentListSelection contains selectedIds, onSelectionChange, optional actions ({ id, label }[]), and onBulkAction(ids, actionId). The action returns or resolves to { succeededIds, failures }; each failure has an entryId and optional message. An ID omitted from both arrays is treated as a failure, and a failure takes precedence if an ID appears in both.

import { createCmsClient } from "@puzzle-ui/fullstack/cms/client";
import { ContentList } from "@puzzle-ui/pieces";

const cms = createCmsClient({ basePath: "/api/cms" });
const articles = cms.collection("articles");

<ContentList
  items={contentListItems}
  locales={contentType.localization.locales}
  onArchive={(entry) => {
    void articles.archive(entry.id, { expectedRevision: entry.revision });
  }}
/>;

The table renders the title field when it is a string or number and falls back to the slug or entry ID. CmsEntryListItem.updatedAt accepts either a Date or the ISO string returned by @puzzle-ui/fullstack/cms/client. Local mode searches and paginates only items. Remote mode preserves server ordering and exposes no local sorting controls; sort choices and requests belong to the host application.

States and accessibility

The component distinguishes loading, empty, error, and permission-denied states. Status and locale controls have visible labels, row actions include entry titles in their accessible names, and local table controls and remote previous/next buttons are keyboard operable.

API maturity

API maturity: Stable.