feat(pagination): add ability to overwrite pagination text#79
Merged
mattrothenberg merged 2 commits intocloudflare:mainfrom Feb 13, 2026
Merged
feat(pagination): add ability to overwrite pagination text#79mattrothenberg merged 2 commits intocloudflare:mainfrom
mattrothenberg merged 2 commits intocloudflare:mainfrom
Conversation
commit: |
Contributor
Docs PreviewCommit: |
Contributor
CiscoFran10
reviewed
Feb 11, 2026
packages/kumo-docs-astro/src/components/demos/PaginationDemo.tsx
Outdated
Show resolved
Hide resolved
mattrothenberg
approved these changes
Feb 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.










What have you changed?
This adds support for a
textargument for the Pagination component. I've done this by adding atextargument which accepts a method that can returnReact.ReactNode. It takes a prop argument of all the variables that a user might want to use to generate custom text.What are you trying to achieve?
I have a table of data which can have thousands of entries in it. Pagination is done via token.
In current usage, we are aware of what the totalCount is, which allows me to pass it in and this will all work fine.
However, we are looking at adding search functionality to this table. In this new circumstance, we will not be aware of what the total count is. Two things are true of our current API design:
While the wrapping interface will be a little ugly, this will allow me to "fake" the totalCount if I have a continuation token - while ensuring that this isn't shown in the text.
What other possibilities are there?
I've explored this space a bit in my previous PR, which introduced "simple" pagination for this component. Even if this is a little gross on my side, this feels the cleanest way from a this API point of view.
Other possible iterations on the
text={({perPage}) => `Hey! ${perPage}`}solution could be either:text={`Hey! ${perPage}`}- as all of the context is technically being passed into the Pagination component, you could avoid the method. I like the fact that our current method gives us easy access to the{pageShowingRange}variable howevertext={"my text"}andtext={() => "my text"}{lowerItem}and{upperItem}instead (or similar), as the dash feels a bit like a presentation concernOther potential changes here could be that
textisn't a great prop name -descriptioncould work better? Happy to change if there are any better suggestions