Skip to content

Count

Fetches and displays item count for a resource.

import { Count } from '@/components/admin';
<Count />

It counts the items of the current resource, using dataProvider.getList() with a pagination of { page: 1, perPage: 1 }.

By default, it uses the current resource from the ResourceContext. You can override them with props, as well as pass a filter:

<Count resource="comments" filter={{ post_id: 123 }} link />
PropRequiredTypeDefaultDescription
filterOptionalobject{}Filter passed to dataProvider
linkOptionalbooleanfalseMake count a link to list
resourceOptionalstringcontextOverride resource
timeoutOptionalnumber1000Delay before spinner