> For the complete documentation index, see [llms.txt](https://docs.fact-finder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fact-finder.com/webcomponents-overview/web-components-4.x./api/navigation/paging.md).

# Paging

Build configurable pagination for FactFinder search results.

## Documentation

### Overview

With the `ff-paging` element, you can build a custom paging for your search results.

A paging may contain several `ff-paging-set` elements, and each `ff-paging-set` element contains several `ff-paging-item` elements.

You can access the page number a paging item represents with the `{{page}}` syntax.

```html
<ff-paging id="paging2">
    <ff-paging-item type="currentLink -2">{{page}}</ff-paging-item>
    <ff-paging-item type="currentLink -1">{{page}}</ff-paging-item>
    <ff-paging-item type="currentLink" style="font-weight: bold;">{{page}}</ff-paging-item>
    <ff-paging-item type="currentLink +1">{{page}}</ff-paging-item>
    <ff-paging-item type="currentLink +2">{{page}}</ff-paging-item>
</ff-paging>
```

## Demo

Try the [Paging demo](https://search-web-components.fact-finder.de/demos/4.x/ff-paging).

## API code

### `ff-paging`

**Properties**

<details>

<summary>Properties</summary>

| Name                                       | Description                             |
| ------------------------------------------ | --------------------------------------- |
| **paging** (Object, default: empty)        | Paging data from FactFinder.            |
| **show-only** (String, default: `"false"`) | Displays pages without allowing clicks. |

</details>

**Events**

<details>

<summary>Events</summary>

| Name            | Description                                                      |
| --------------- | ---------------------------------------------------------------- |
| **dom-updated** | Fires after the element receives data and renders its templates. |

</details>

### `ff-paging-set`

**Properties**

<details>

<summary>Properties</summary>

| Name                                     | Description                                           |
| ---------------------------------------- | ----------------------------------------------------- |
| **state** (String, default: `"all"`)     | Expression that determines whether the set is active. |
| **is-active** (Boolean, default: `true`) | Determines whether the paging set is active.          |
| **paging** (Object, default: empty)      | Paging data from FactFinder.                          |

</details>

**Methods**

<details>

<summary>Methods</summary>

| Name           | Description           |
| -------------- | --------------------- |
| **hideSelf()** | Hides the paging set. |
| **showSelf()** | Shows the paging set. |

</details>

### `ff-paging-item`

**Properties**

<details>

<summary>Properties</summary>

| Name                                     | Description                                                                                   |
| ---------------------------------------- | --------------------------------------------------------------------------------------------- |
| **type** (String, default: `"pageLink"`) | Page type: `currentLink`, `firstLink`, `lastLink`, `nextLink`, `previousLink`, or `pageLink`. |
| **paging-item** (Object, default: empty) | Paging item data from FactFinder.                                                             |
| **show-only** (String, default: empty)   | Displays the page without allowing clicks.                                                    |

</details>

### show-only

When the `show-only` attribute is present, the paging does not react to clicks.

```html
<ff-paging show-only>
    //...
</ff-paging>
```

### paging-set

Define different `ff-paging-set` elements based on which page you are on right now.

The `state` attribute is evaluated as a boolean expression. When its value is `true`, the `ff-paging-set` is visible.

The possible variables to build the expressions are `currentPage`, `pageCount`, and numeric values.

```html
<ff-paging>
    <ff-paging-set state="currentPage <= 3">
        ...
    </ff-paging-set>

    <ff-paging-set state="currentPage > 3 && pageCount-currentPage >= 3">
        ...
    </ff-paging-set>

    <ff-paging-set state="pageCount-currentPage < 3  && currentPage > 3">
        ...
    </ff-paging-set>
</ff-paging>
```

### paging-item

You can style the different `ff-paging-item` elements and define which links you want to display in a given paging-set.

This might look cumbersome and bloated, but it gives a very defined and in-depth way to design your paging element.

You have to set a `type` attribute in the `ff-paging-item` where you select a "page". This is an expression built from the possible values below:

* **firstLink**: Points to the first page.
* **lastLink**: Points to the last page.
* **nextLink**: Points to the next page if available. (`currentPage +1`)
  * *Usually this link is displayed as an arrow or something similar.*
* **previousLink**: Points to the previous page if available. (`currentPage -1`)
  * *Usually this link is displayed as an arrow or something similar.*
* **currentLink**: Points to the current page. You can add or subtract to define a specific page like `currentLink+2` or `currentLink-1`.

{% hint style="info" %}
The `ff-paging-item` will only be visible when the expression resolves to a valid page.
{% endhint %}

The paging-item also has a `show-only` attribute and works like the `show-only` on the paging itself.

Between the `ff-paging-items`, you can add placeholders such as `...`. They will always be visible.

**Rendered HTML**

The template you provide in an `ff-paging-item` tag will be rendered inside a wrapping `div`:

```html
<!-- Currently selected item -->
<ff-paging-item type="currentLink" class="ffw-selected">
	<div class="ffw-page-item-container ffw-cursor">1</div>
</ff-paging-item>

<!-- Regular visible and clickable item -->
<ff-paging-item type="currentLink +1" class="">
	<div class="ffw-page-item-container ffw-cursor">2</div>
</ff-paging-item>
```

### Example implementation

```html
<ff-paging id="paging3" class="paging3">
    <ff-paging-set id="p3set1" state="currentPage <= 3">
        <ff-paging-item type="previousLink">{{page}}</ff-paging-item>

        <ff-paging-item type="currentLink -2">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink -1">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink" style="font-weight: bold;">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink +1">{{page}}</ff-paging-item>
        ...
        <ff-paging-item type="nextLink">{{page}}</ff-paging-item>
        <ff-paging-item type="lastLink">last</ff-paging-item>
    </ff-paging-set>

    <ff-paging-set id="p3set2" state="currentPage > 3 && pageCount-currentPage >= 3">
        <ff-paging-item type="firstLink">{{page}}</ff-paging-item>

        <ff-paging-item type="previousLink">{{page}}</ff-paging-item>
        ...
        <ff-paging-item type="currentLink -1">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink" style="font-weight: bold;">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink +1">{{page}}</ff-paging-item>
        ...
        <ff-paging-item type="nextLink">{{page}}</ff-paging-item>

        <ff-paging-item type="lastLink">{{page}}</ff-paging-item>
    </ff-paging-set>

    <ff-paging-set id="p3set3" state="pageCount-currentPage < 3 && currentPage > 3">
        <ff-paging-item type="firstLink">first</ff-paging-item>
        <ff-paging-item type="previousLink">{{page}}</ff-paging-item>
        ...
        <ff-paging-item type="currentLink -1">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink" style="font-weight: bold;">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink +1">{{page}}</ff-paging-item>
        <ff-paging-item type="currentLink +2">{{page}}</ff-paging-item>

        <ff-paging-item type="nextLink">{{page}}</ff-paging-item>
    </ff-paging-set>
</ff-paging>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fact-finder.com/webcomponents-overview/web-components-4.x./api/navigation/paging.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
