# Blazor Pager Overview

The <a href="https://www.telerik.com/blazor-ui/pager" target="_blank">Blazor Pager component</a> will enable you to add paging for your data in a Blazor application. We use it in components like the Grid and ListView, and you can also use it for your own templates and data as a standalone component.

The Pager provides the UI for the user to change the page. To the developer, it provides the page index so you can render only the relevant data portion and an [event](https://www.telerik.com/blazor-ui/documentation/components/pager/events) that you can use to implement [load on demand](https://www.telerik.com/blazor-ui/documentation/components/pager/overview#load-on-demand).

## Creating Blazor Pager

1. Add the `TelerikPager` tag to a Razor file.

2. Set the `Total` property to the number of items in the data source.

3. Set the `PageSize` parameter to determine the desired subset of data. It supports two-way binding.

4. Set the `Page` (one-way or two-way binding) parameter to an `int` object. The page indexes are 1-based.

> caption Use the TelerikPager to paginate your own data and content.

<demo metaUrl="client/pager/overview/paginate-content/" height="400"></demo>

## Events

The Blazor Pager exposes PageChanged and PageSizeChanged events that you can handle and further customize its behavior. [Read more about the Blazor Pager events](https://www.telerik.com/blazor-ui/documentation/components/pager/events).

## Pager Parameters

The Blazor Pager provides various parameters that allow you to configure the component:

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter      | Type and Default Value                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AdaptiveMode` | `AdaptiveMode` enum <br /> (`None`)      | Defines the adaptive mode of the Pager. When set to `Auto`, and the window width is below [`768px` or `RootComponentAdaptiveSettings.Medium`](https://www.telerik.com/blazor-ui/documentation/common-features/adaptive-rendering#rendering-specifics), components with popups will render them as an `ActionSheet`. In this case, the page sizes dropdown only.                                                                                                                    |
| `ButtonCount`  | `int`                                    | The maximum number of page buttons that will be visible. To take effect, `ButtonCount` must be smaller than the page count (`ButtonCount < Total / PageSize`).                                                                                                                                                                                                                                                                                                                     |
| `Class`        | `string`                                 | Renders a custom CSS class to the `<div class="k-pager-wrap">` element.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `Page`         | `int`                                    | Represents the current page of the pager. The first page has an index of `1`. Supports two-way binding. If no value is provided, the parameter will default to the first page (1), but you should always use this parameter value in order to successfully use the component. If you don't use two-way binding and you don't update the value of the parameter after the user action, the pager UI will not reflect the change and will revert to the previous value (page index). |
| `PageSize`     | `int`                                    | The number of items to display on a page. Supports two-way binding.                                                                                                                                                                                                                                                                                                                                                                                                                |
| `PageSizes`    | `List<int?>`                             | Allows users to change the page size via a DropDownList. The attribute configures the DropDownList options. A `null` item in the `PageSizes` `List` will render an "All" option. By default, the Pager DropDownList is not displayed. You can also set `PageSizes` to `null` programmatically to remove the DropDownList at any time.                                                                                                                                              |
| `InputType`    | `PagerInputType` enum <br /> (`Buttons`) | Determines if the pager will show numeric buttons to go to a specific page, or a textbox to type the page index. The arrow buttons are always visible. The `PagerInputType` enum accepts values `Buttons` (default) or `Input`. When `Input` is used, the page index will change when the textbox is blurred, or when the user hits Enter. This is to avoid unintentional data requests.                                                                                           |
| `Responsive`   | `bool` <br /> (`true`)                   | Defines whether pager elements change based on the screen size. When enabled, the Pager will hide its `Pager Info` and `PageSize Dropdownlist` if they cannot fit in the available space. In the smallest resolution, the page buttons will be rendered as a select element.                                                                                                                                                                                                       |
| `ShowInfo`     | `bool` <br /> (`true`)                   | Defines whether the information about the current page and the total number of records is present.                                                                                                                                                                                                                                                                                                                                                                                 |
| `Total`        | `int`                                    | Represents the total count of items in the pager.                                                                                                                                                                                                                                                                                                                                                                                                                                  |

### Styling and Appearance

The following parameters enable you to customize the appearance of the Blazor Pager:

| Parameter | Type                                       | Description                  |
| --------- | ------------------------------------------ | ---------------------------- |
| `Size`    | `Telerik.Blazor.ThemeConstants.Pager.Size` | Adjust the size of the Pager |

You can find more information for customizing the Pager appearance in the [Appearance article](https://www.telerik.com/blazor-ui/documentation/components/pager/appearance).

## Examples

### Load On Demand

Loading all the data at once can be a costly operation. In such a case, use the `PageChanged` event of the Pager component to fetch the new subset of data to render. It is important to always provide the correct `Total` count of items in the full data source to the component so it can render the correct amount of page buttons.

> caption Load paged data on demand

<demo metaUrl="client/pager/overview/load-on-demand/" height="550"></demo>

### Two-way Binding

The `Page` parameter supports two-way binding so it can respond to changes from other element, and to also update other elements. This is the most straightforward use of the component. As an alternative, use the `PageChanged` event to implement additional logic when paging the data, such as [loading it on demand](https://www.telerik.com/blazor-ui/documentation/components/pager/overview#load-on-demand).

<demo metaUrl="client/pager/overview/two-way-binding/" height="250"></demo>

## Next Steps

* [Explore the Pager Events](https://www.telerik.com/blazor-ui/documentation/components/pager/events)

## See Also

* [Live Pager Demos](https://demos.telerik.com/blazor-ui/pager/overview)
* [Pager API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikpager)
* [How to increase the pager dropdownlist width](https://www.telerik.com/blazor-ui/documentation/knowledge-base/pager-dropdown-width)
