I’ve been working with some some APIs that have some different patterns for pagination. Which got me to thinking about naming an pagination conventions.
The Problem with ‘up’ and ‘down’ naming
Namely, when describing pagination actions I think it’s probably best to avoid ‘up’ and ‘down’ for naming. These are descriptive words for the ui, not so much of the data.
A -> Z
That is ‘up’ could potentially mean different things in the data depending one what you’re presenting. Let’s say you sort you a list
A -> Z by default. What does
down look like in both of these situations. ‘down’ in our minds may imply ‘down’ the alphabet towards the end. But if we can sort to
Z -> A the idea of
down becomes ambiguous and a bit confusing. For instance if we’re sitting on page
M and say
down which way does that mean?
Newsted -> Oldest
Let’s consider something that has more chronology. Perhaps a list of recent transactions sorted by date. We could safely presume as you scroll
down you retrieve older and older transactions. Describing the each page as
down seems reasonable, we’re paging
down in time. Specifically the unix epoch timestamp is a number that literally goes down as you go back in time.
1508480000. Makes sense.
Now let’s flip our transaction order to be Oldest first. Now we go
1508480500 when paginating
down make the number go up. That can get confusing.
Scroll down -> Ticker
To emphasis the opinion of
down being a UI concern and description. Let’s try one last scenario.
Let’s say we a have a simple twitter feed where we render out messages. Let’s say it’s your typical feed that scrolls down along the page. Paging
down make sense here.
But let’s say we introduce stock ticker-styled feed, well now
down doesn’t make as much sense.
Paginate via a term that is more generic like
previous seems much cleaner regardless of the UI rendering style.
- They don’t describe the UI directly.
- They don’t per-say describe the direction of sorting.
- Describe the data intent of getting the
- They are ambiguous enough that
nextdon’t imply direction but rather intent.
Pagination is hard
Pagination naming is hard, but good design is amazing. These are just some of my observation and thoughts after working with different apps and APIs. Who knows, maybe there is something better!