ListPage
Auto-generates a list page with columns generated based on the provided query document fields.
Example
Parameters
props
Readonly<ListPageProps<T, U, V, AC>>Props to configure the ListPage component.
pageId
stringA unique identifier for the list page. This is important to support customization functionality that relies on page IDs and makes your component extensible.
route
AnyRoute | (() => AnyRoute)- The Tanstack Router
Routeobject, which will be defined in the component file.
title
string | React.ReactElement- The page title, which will display in the header area.
listQuery
TThis DocumentNode of the list query, i.e. a query that fetches PaginatedList data with "items" and "totalItems", such as:
Example
deleteMutation
TypedDocumentNode<any, { id: string }>Providing the deleteMutation will automatically add a "delete" menu item to the
actions column dropdown. Note that if this table already has a "delete" bulk action,
you don't need to additionally provide a delete mutation, because the bulk action
will be added to the action column dropdown already.
transformVariables
(variables: V) => VThis prop can be used to intercept and transform the list query variables before they are sent to the Admin API.
This allows you to implement specific logic that differs from the standard filter/sort handling.
Example
onSearchTermChange
(searchTerm: string) => NonNullable<V['options']>['filter']Allows you to customize how the search term is used in the list query options. For instance, when you want the term to filter on specific fields.
Example
additionalColumns
ACAllows you to define extra columns that are not related to actual fields returned in the query result.
For example, in the Administrator list, we define an additional "name" column composed
of the firstName and lastName fields.
Example
defaultColumnOrder
(keyof ListQueryFields<T> | keyof AC | CustomFieldKeysOfItem<ListQueryFields<T>>)[]Allows you to specify the default order of columns in the table. When not defined, the order of fields in the list query document will be used.
defaultSort
SortingStateAllows you to specify the default sorting applied to the table.
Example
defaultVisibility
Partial< Record<keyof ListQueryFields<T> | keyof AC | CustomFieldKeysOfItem<ListQueryFields<T>>, boolean> >Allows you to specify the default columns that are visible in the table.
If you set them to true, then only those will show by default. If you set them to false,
then all other columns will be visible by default.
Example
children
React.ReactNodefacetedFilters
FacetedFilterConfig<T>Allows you to define pre-set filters based on an array of possible selections
Example
rowActions
RowAction<ListQueryFields<T>>[]Allows you to specify additional "actions" that will be made available in the "actions" column.
By default, the actions column includes all bulk actions defined in the bulkActions prop.
transformData
(data: any[]) => any[]Allows the returned list query data to be transformed in some way. This is an advanced feature that is not often required.
setTableOptions
(table: TableOptions<any>) => TableOptions<any>Allows you to directly manipulate the Tanstack Table TableOptions object before the
table is created. And advanced option that is not often required.
bulkActions
BulkAction[]Bulk actions are actions that can be applied to one or more table rows, and include things like
- Deleting the rows
- Assigning the rows to another channel
- Bulk editing some aspect of the rows
See the BulkAction docs for an example of how to build the component.
Example
registerRefresher
PaginatedListRefresherRegisterFnRegister a function that allows you to assign a refresh function for this list. The function can be assigned to a ref and then called when the list needs to be refreshed.
onReorder
(oldIndex: number, newIndex: number, item: any) => void | Promise<void>Callback when items are reordered via drag and drop. Only applies to top-level items. When provided, enables drag-and-drop functionality.
disableDragAndDrop
booleanWhen true, drag and drop will be disabled. This will only have an effect if the onReorder prop is also set Useful when filtering or searching.
Defaults to false. Only relevant when onReorder is provided.