# Pager Template

To take full control over the [Angular Grid](https://www.telerik.com/kendo-angular-ui/components/grid) pager layout, content, and functionality, use the [`PagerTemplateDirective`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagertemplatedirective). It allows you to mix and match built-in Pager building blocks with any other Angular components or DOM elements.

> Starting with [`v17.0.0`](https://www.telerik.com/kendo-angular-ui/components/changelogs/kendo-angular-ui#v17.0.0), the Grid's internal pager is replaced by the [Pager component](https://www.telerik.com/kendo-angular-ui/components/pager). The following breaking changes affect the pager template:
>
> * instead of `kendoGridFocusable` use [`kendoPagerFocusable`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerfocusabledirective).
> * instead of `kendo-grid-spacer` use [`kendo-pager-spacer`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerspacercomponent).

## Using Built-in Pager Components

To customize the Pager, use the following built-in components:

* [`PagerInfoComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerinfocomponent)—Shows information about the current page and the total number of records.
* [`PagerInputComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerinputcomponent)—Displays an input element which allows typing and rendering of page numbers.
* [`PagerNextButtonsComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagernextbuttonscomponent)—Displays buttons for navigating to the next and the last page.
* [`PagerNumericButtonsComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagernumericbuttonscomponent)—Displays numeric buttons for navigation between the pages.
* [`PagerPageSizesComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerpagesizescomponent)—Displays a drop-down list for the page size selection.
* [`PagerPrevButtonsComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerprevbuttonscomponent)—Displays buttons for navigating to the first and previous page.
* [`PagerSpacerComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerspacercomponent)—Provides additional white space between the pager inner elements.

> The default `padding` of the built-in Grid paging components could be changed according to the set [`size`](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent#size) option of the Grid.

The following example demonstrates how to define the built-in pager components inside an `<ng-template>` tag with applied [`kendoPagerTemplate`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagertemplatedirective) directive.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/paging/pager-template/built-in/source.txt)

## Using Other Components

In some scenarios, the built-in pager elements do not entirely meet your requirements. In such cases, the [`PagerTemplateDirective`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagertemplatedirective) enables you to use any set of Angular components and DOM elements that fit the specific use case.

The following example demonstrates how to use the [Kendo UI for Angular Slider](https://www.telerik.com/kendo-angular-ui/components/inputs/slider) to paginate the data.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/paging/pager-template/custom/source.txt)

## Implementing Keyboard Navigation

When you use only built-in Pager components in the Pager template, the default Pager [keyboard navigation](https://www.telerik.com/kendo-angular-ui/components/pager/keyboard-navigation) will work out-of-the-box.

To preserve the keyboard navigation functionality when using other Angular components or focusable HTML elements in the Pager template, place the [`kendoPagerFocusable`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerfocusabledirective) directive on each focusable element.

The following example demonstrates how to use a [Slider component](https://www.telerik.com/kendo-angular-ui/components/inputs/slider) for changing the page and an HTML Input element for setting the page size.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/paging/pager-template/kb-nav/source.txt)

## Defining Spacing between the Pager Elements

The [`PagerSpacerComponent`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerspacercomponent) component enables you to add free space between the Pager's inner elements and arrange them. By default, each `<kendo-pager-spacer>` element occupies all available space. To override this behavior and specify a custom size, use the [`width`](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagerspacercomponent#width) property.

The following example demonstrates how to position the numeric buttons in the center of the available Pager space.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/paging/pager-template/spacing/source.txt)

## Suggested Links

* [PagerTemplateDirective](https://www.telerik.com/kendo-angular-ui/components/pager/api/pagertemplatedirective)
* [PagerSettings](https://www.telerik.com/kendo-angular-ui/components/grid/api/pagersettings)
* [API Reference of the GridComponent](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent)
* [API Index of the Grid](https://www.telerik.com/kendo-angular-ui/components/grid/api)
* [Paging Basics](https://www.telerik.com/kendo-angular-ui/components/grid/paging/basics)
