---
name: Pagination
menu: Components
route: /components/pagination
---

import { Playground, PropsTable } from 'docz'
import { Pagination } from '@personio/ui-components'
import { State, Toggle } from 'react-powerplug'

# Pagination
Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages.

We use a large block of connected links for our pagination, making links hard to miss and easily scalable—all while providing large hit areas.
Pagination is built with list HTML elements so screen readers can announce the number of available links.

<PropsTable of={Pagination} />

## Examples
In order to use pagination component, you should define total, limit and offset properties. They follow the same standard that we use for pagination in the backend, so, you don't need to change anything :)

<Playground>
  <div className="pagination-container">
    <State initial={{ offset: 0 }}>
      {({ state, setState }) => (
        <Pagination
          total={100}
          limit={10}
          offset={state.offset}
          maxItems={5}
          onChange={(offset) => {
            setState({ offset })
          }}
        />
      )}
    </State>
  </div>
</Playground>

## Working with icons
Looking to use an icon or symbol in place of text for some pagination links?

<Playground>
  <div className="pagination-container">
    <State initial={{ offset: 0 }}>
      {({ state, setState }) => (
        <Pagination
          total={100}
          limit={10}
          offset={state.offset}
          maxItems={5}
          onChange={(offset) => {
            setState({ offset })
          }}
        />
      )}
    </State>
  </div>
</Playground>

## Defining the number of items

<Playground>
  <div className="pagination-container">
    <State initial={{ offset: 0 }}>
      {({ state, setState }) => (
        <Pagination
          theme="danger"
          total={1000}
          limit={10}
          offset={state.offset}
          maxItems={10}
          onChange={(offset) => {
            setState({ offset })
          }}
        />
      )}
    </State>
  </div>
</Playground>

## Aligning center

<Playground>
  <div className="pagination-container">
    <State initial={{ offset: 0 }}>
      {({ state, setState }) => (
        <Pagination
          theme="danger"
          total={9}
          limit={10}
          offset={state.offset}
          maxItems={10}
          onChange={(offset) => {
            setState({ offset })
          }}
        />
      )}
    </State>
  </div>
</Playground>

