Rost

← All components

component

Pagination

Moving through a long list a page at a time. Back and forward buttons with where you are between them.

In code Contract: review Guidance: proposed Contract on GitHub Figma 742:43 As markdown

Try it

Every variant

Default

Install

npx github:Runceanu/rost add pagination

It lands in src/rost/pagination/, with what it needs and its contract. Install has the rest.

When to use

  • Long lists

    Invoices, transactions, clients: anything longer than a screen where the order matters and people go back and forth.

When not to use

  • Short lists

    Under fifty rows, show them all.

  • Feeds

    Something people scroll through once. Load more as they reach the end.

Behaviour

Back, where you are, forward. I left out page numbers to jump to: in the apps people go one page at a time, and "Page 3 of 12" says enough. The buttons are disabled at either end.

Accessibility

  • Element

    <nav aria-label="Pagination">, with two IconButtons labelled Previous page and Next page.

  • Name

    The buttons by what they do. The label says where you are, and aria-live reads the new page when it changes.

  • Keyboard

    Tab reaches the buttons; Enter or Space turns the page.

  • Colour

    The label is 11:1 on the dark page.

Content

"Page 3 of 12", in numbers.

Props

PropTypeValuesDefault
page number
pages number

Values

Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.

Never changes

root

  • gap 8px spacing/gap/small

displayinline-flex · align-itemscenter

previous

flex-shrink0

label

  • padding-left 8px spacing/gap/small
  • padding-right 8px spacing/gap/small
  • font-family 'General Sans Variable' font-family/base
  • font-weight 400 typography/paragraph/font-weight/regular
  • font-size 14px typography/paragraph/font-size
  • line-height 20px typography/paragraph/line-height
  • letter-spacing 0px typography/paragraph/letter-spacing
  • color #d3d9d5 pagination/label

white-spacenowrap

next

flex-shrink0