This component no longer exists. It was in Wednesday UI’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-13 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
paginate
wednesday-ui/paginateRemovedUtility
Wednesday UI publishes no description for this item.
Install it
npx shadcn@latest add https://ui.ednesdayw.com/r/paginate.jsonSource
1interface PaginateProps {2 currentPage: number;3 totalPages: number;4 siblings?: number;5}67const range = (start: number, end: number) => {8 return Array.from({ length: end - start }, (_, i) => i + start);9};1011const between = (num: number, min: number, max: number) => {12 return Math.max(min, Math.min(num, max));13};1415export const paginate = ({16 currentPage,17 totalPages,18 siblings = 2,19}: PaginateProps) => {20 const page = between(currentPage, 1, totalPages);21 const max = totalPages - 1;2223 const left = between(24 page - siblings,25 2,26 Math.min(max - siblings * 2 - 1, max),27 );28 const right = between(29 page + siblings,30 Math.min(2 + siblings * 2 + 1, max),31 max,32 );3334 const hasLeftEllipsis = left - 1 > 2;35 const hasRightEllipsis = totalPages - right > 2;3637 const middle = range(38 left - 1 === 2 ? left - 1 : left,39 totalPages - right === 2 ? right + 2 : right + 1,40 );4142 const items = [43 { type: "item", value: 1 },44 ...(hasLeftEllipsis45 ? [46 {47 type: "ellipsis",48 value: between(page - siblings * 2 - 1, 1, totalPages),49 },50 ]51 : []),52 ...middle.map((n) => ({ type: "item", value: n })),53 ...(hasRightEllipsis54 ? [55 {56 type: "ellipsis",57 value: between(page + siblings * 2 + 1, 1, totalPages),58 },59 ]60 : []),61 ...(totalPages >= 2 ? [{ type: "item", value: totalPages }] : []),62 ];6364 return {65 prev: page > 1 ? page - 1 : null,66 next: page < totalPages ? page + 1 : null,67 current: page,68 items,69 };70};7172export type PaginateReturn = ReturnType<typeof paginate>;
