Command Palette

Search for a command to run...

Docs
Icon Pagination

Icon Pagination

Pagination component with colorful icon indicators and tooltip labels

Loading...

Installation

Usage

import IconPagination from "@/components/ruixen/icon-pagination";
 
export default function App() {
  const handlePageChange = (page: number) => {
    console.log(`Current page: ${page + 1}`);
  };
 
  return (
    <IconPagination
      totalPages={200}
      maxVisible={5}
      onChange={handlePageChange}
    />
  );
}

Props

PropTypeDefaultDescription
totalPagesnumber200Total number of pages
maxVisiblenumber5Maximum icons to show around active page
onChangefunction-Callback when page changes
classNamestring""Additional CSS classes

Features

  • Colorful Icons: Each page has a colored square icon (5 color rotation)
  • Smart Ellipsis: Shows "..." when there are gaps in page numbers
  • Tooltips: Hover to see page labels
  • Scale Animation: Active page scales up (110%)
  • Responsive Layout: Flexbox layout that wraps on smaller screens

Icon Colors

The component cycles through 5 colors for the page icons:

  • Red (pages 0, 5, 10, ...)
  • Green (pages 1, 6, 11, ...)
  • Blue (pages 2, 7, 12, ...)
  • Yellow (pages 3, 8, 13, ...)
  • Purple (pages 4, 9, 14, ...)

Layout Logic

  • Always shows first and last page
  • Shows ellipsis (...) when there are gaps
  • Centers visible pages around the current active page
  • Maintains consistent spacing and alignment