Skip to content

Conversation

@tcrz
Copy link
Collaborator

@tcrz tcrz commented Sep 28, 2025

Pull Request

Description

This PR adds page number buttons to the pagination component with smart ellipsis logic, making it easier for users to navigate directly to specific pages. The feature is opt-in via a new showPageNumbers prop to maintain backward compatibility.

What's Added

New Features

  • Smart page number display with ellipsis for large page counts
Small page counts (≤5): Shows all pages [1] [2] [3] [4] [5]
Near beginning: Shows [1] [2] [3] ... [10]
Near end: Shows [1] ... [8] [9] [10]
Middle: Shows [1] ... [4] [5] [6] ... [10]
  • Opt-in feature via showPageNumbers prop (defaults to false)
  • Active page highlighting with customizable styling
<Table
   ...
   classNames={{
    pagination: {
       // pageButton styliing
       pageButton: "px-3 py-1 text-sm bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors min-w-[2rem] text-center",
      // pageButton active state styliing
       activePageButton: "px-3 py-1 text-sm bg-blue-600 border border-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors min-w-[2rem] text-center",
    },
  }}
  showPageNumbers={true}
/>
  • Full accessibility support (aria-current, aria-labels)
  • Dark mode support for all new styles

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes, no api changes)
  • Performance improvement
  • Test improvement

Testing

  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

Add screenshots to help explain your changes.
Screenshot 2025-09-28 184748

Related Issues

Fixes #(issue number)

Additional Notes

Any additional information about the PR that reviewers should know.

@ninsau ninsau merged commit 9dc516d into ninsau:main Sep 28, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants