ProList API
ProList is an enhanced list component that combines ProTable features with Ant Design List, supporting data fetching, search forms, and flexible item rendering.
ProListProps
Extends ProTable props and Ant Design List props.
Column configuration with listSlot property to map data to list item slots. Show Available List Slots
title - Item title
subTitle - Item subtitle
avatar - Item avatar
description - Item description
content - Item main content
actions - Item action buttons
aside - Item aside content
type - Item type indicator
Legacy API for mapping data to list item parts. Use columns with listSlot instead. // Old API (deprecated)
< ProList
metas = { {
title: { dataIndex: 'name' },
avatar: { dataIndex: 'avatar' },
} }
/>
// New API (recommended)
< ProList
columns = { [
{ title: 'Name' , dataIndex: 'name' , listSlot: 'title' },
{ dataIndex: 'avatar' , listSlot: 'avatar' },
] }
/>
Method to fetch data from the server. ( params : U & {
pageSize ?: number ;
current ?: number ;
keyword ?: string ;
}, sort : Record < string , SortOrder >, filter : Record < string , FilterValue >) => Promise < RequestData < DataSource >>
Static data source for the list.
rowKey
string | function
default: "key"
Unique key for each list item. string | (( record : T ) => React . Key )
Reference to control the list programmatically. Methods:
reload() - Reload list data
reset() - Reset list and form state
clearSelected() - Clear row selection
List Display
itemLayout
'horizontal' | 'vertical'
default: "horizontal"
Layout of list items.
horizontal - Horizontal layout with avatar/content side by side
vertical - Vertical layout with content stacked
Whether to show divider between items.
variant
'outlined' | 'borderless'
default: "borderless"
List variant.
outlined - List with border
borderless - List without border
size
'default' | 'large' | 'small'
default: "default"
List size.
Grid layout configuration. type ListGridType = {
gutter ?: number | [ number , number ];
column ?: number ;
xs ?: number ;
sm ?: number ;
md ?: number ;
lg ?: number ;
xl ?: number ;
xxl ?: number ;
}
< ProList
grid = { {
gutter: 16 ,
xs: 1 ,
sm: 2 ,
md: 3 ,
lg: 3 ,
xl: 4 ,
xxl: 4 ,
} }
/>
Pagination configuration. Set to false to disable.
Loading state for the list.
Custom load more component.
Locale configuration. type ListLocale = {
emptyText ?: React . ReactNode ;
}
Item Rendering
Custom render for entire list item. ( item : T , index : number , defaultDom : React . ReactElement ) => React . ReactNode
The defaultDom parameter is the default rendered list item that you can customize or replace.
Custom render for list item header. ( item : T , index : number ) => React . ReactNode
Custom render for list item title. ( item : T , index : number ) => React . ReactNode
Class name for list item row. string | (( item : T , index : number ) => string )
Props to add to the list item wrapper element. ( record : T , index : number ) => React . HTMLAttributes < HTMLElement >
Props to add to the list item content element. ( record : T , index : number ) => React . HTMLAttributes < HTMLElement >
Props for selectable card items (when using CheckCard).
search
false | SearchConfig
default: "false"
Search form configuration. Inherited from ProTable. Set to object to enable: < ProList
search = { {
filterType: 'light' ,
} }
/>
Custom render for toolbar actions. ( action : ActionType , rows : T []) => React . ReactNode []
options
OptionConfig | false
default: "false"
Table options configuration (reload, density, settings).
tooltip
string | LabelTooltipType
Tooltip for the header title.
Selection
rowSelection
TableRowSelection | false
default: "false"
Row selection configuration. Show TableRowSelection Properties
selectedRowKeys?: Key[] - Controlled selected keys
onChange?: (selectedRowKeys: Key[], selectedRows: T[]) => void
getCheckboxProps?: (record: T) => object - Checkbox props
selections?: boolean | SelectionItem[] - Selection dropdown
type?: 'checkbox' | 'radio'
Expandable row configuration.
Card Props
Props for the outer card wrapper. Set to false to disable card.
Border configuration for the card.
Ghost mode - removes card padding and background.
Data Handling
Inherited from ProTable:
Additional request parameters. Changes trigger reload.
Process data after request.
Callback after data loads. ( dataSource : T []) => void
Callback when request fails.
Polling interval in milliseconds.
Manually trigger request.
Auto reload when window gains focus.
Debounce time for form changes in milliseconds.
Usage Examples
Basic List
Grid Layout
With Search
Custom Item Render
With Selection
import { ProList } from '@ant-design/pro-components' ;
import { Avatar } from 'antd' ;
export default () => (
< ProList
columns = { [
{
dataIndex: 'avatar' ,
listSlot: 'avatar' ,
valueType: 'avatar' ,
},
{
title: 'Name' ,
dataIndex: 'name' ,
listSlot: 'title' ,
},
{
dataIndex: 'description' ,
listSlot: 'description' ,
},
{
dataIndex: 'actions' ,
listSlot: 'actions' ,
valueType: 'option' ,
render : ( _ , record ) => [
< a key = "edit" > Edit </ a > ,
< a key = "delete" > Delete </ a > ,
],
},
] }
request = {async ( params ) => {
const response = await fetch ( '/api/users' );
const data = await response . json ();
return {
data: data . list ,
success: true ,
total: data . total ,
};
} }
/>
) ;
< ProList
grid = { {
gutter: 16 ,
xs: 1 ,
sm: 2 ,
md: 3 ,
lg: 3 ,
xl: 4 ,
xxl: 4 ,
} }
columns = { [
{
dataIndex: 'title' ,
listSlot: 'title' ,
},
{
dataIndex: 'image' ,
listSlot: 'avatar' ,
valueType: 'image' ,
},
{
dataIndex: 'description' ,
listSlot: 'description' ,
},
] }
dataSource = { data }
/>
< ProList
search = { {
filterType: 'light' ,
} }
toolBarRender = { () => [
< Button key = "create" type = "primary" >
Create
</ Button > ,
] }
columns = { [
{
title: 'Name' ,
dataIndex: 'name' ,
listSlot: 'title' ,
},
{
title: 'Status' ,
dataIndex: 'status' ,
valueType: 'select' ,
valueEnum: {
active: { text: 'Active' , status: 'Success' },
inactive: { text: 'Inactive' , status: 'Default' },
},
},
] }
request = { fetchData }
/>
< ProList
itemRender = { ( item , index , defaultDom ) => (
< Card hoverable >
{ defaultDom }
</ Card >
) }
columns = { [
{
dataIndex: 'title' ,
listSlot: 'title' ,
},
{
dataIndex: 'content' ,
listSlot: 'content' ,
},
] }
dataSource = { data }
/>
const [ selectedRows , setSelectedRows ] = useState ([]);
< ProList
rowSelection = { {
selectedRowKeys: selectedRows ,
onChange : ( keys , rows ) => {
setSelectedRows ( keys );
},
} }
columns = { columns }
dataSource = { data }
/>