BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/guarahooks/use-pagination-demo

UsePaginationDemo

guarahooks/use-pagination-demo
FreeExample

use-pagination's hook in action.

Live preview

live · rendered by the registry
Rendered by guarahooks on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://guarahooks.com/r/use-pagination-demo.json

Source

registry/example/use-pagination-demo.tsxguarahooks.com/r/use-pagination-demo.json
1'use client';
2
3import React from 'react';
4
5import { Button } from '@/components/ui/button';
6import {
7 Card,
8 CardContent,
9 CardDescription,
10 CardFooter,
11 CardHeader,
12 CardTitle,
13} from '@/components/ui/card';
14
15import { usePagination } from '@/hooks/guarahooks/use-pagination';
16
17export default function UsePaginationDemo() {
18 const totalItems = 100;
19 const {
20 page,
21 pageSize,
22 totalPages,
23 setPage,
24 nextPage,
25 prevPage,
26 setPageSize,
27 } = usePagination(totalItems, { initialPage: 1, initialPageSize: 10 });
28
29 return (
30 <Card className="relative max-w-sm w-full">
31 <CardHeader>
32 <CardTitle>usePagination</CardTitle>
33 <CardDescription>
34 Example of pagination using the <code>usePagination</code> hook.
35 </CardDescription>
36 </CardHeader>
37
38 <CardContent>
39 <p>
40 Page: <strong>{page}</strong> of <strong>{totalPages}</strong>
41 </p>
42 <p>
43 Items per page: <strong>{pageSize}</strong>
44 </p>
45 </CardContent>
46
47 <CardFooter className="flex flex-wrap gap-2">
48 <Button onClick={() => setPageSize(5)}>5 / page</Button>
49 <Button onClick={() => setPageSize(10)}>10 / page</Button>
50 <Button onClick={() => setPageSize(20)}>20 / page</Button>
51 <Button onClick={prevPage} disabled={page <= 1}>
52 Previous
53 </Button>
54 <Button onClick={nextPage} disabled={page >= totalPages}>
55 Next
56 </Button>
57 </CardFooter>
58 </Card>
59 );
60}

What it pulls in

Other registry items

  • card
  • button
  • https://guarahooks.com/r/use-pagination.json

Files it writes

  • registry/example/use-pagination-demo.tsx

Facts

Registry
guarahooks
Type
registry:example
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
today

Go to the source

Docs on guarahooks guarahooks.com h3rmel/guarahooks on GitHub Raw registry item This item as JSON

More from guarahooks

All 100 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
UseAbortControllerDemouse-abort-controller-demoguarahooksExamplesFreeno deps
UseArrayStateDemouse-array-state-demoguarahooksExamplesFreeno deps
UseAxiosDemouse-axios-demoguarahooksExamplesFreeno deps
UseBatteryStatusDemouse-battery-status-demoguarahooksExamplesFreeno deps
UseBetterAuthDemouse-better-auth-demoguarahooksExamplesFreeno deps
UseClickOutsideDemouse-click-outside-demoguarahooksExamplesFreeno deps
UseConfirmDemouse-confirm-demoguarahooksExamplesFreeno deps
UseCookieDemouse-cookie-demoguarahooksExamplesFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex