# Pagination > Page navigation controls for paginated content Source: https://shellui.dev/docs/v0.3/components/navigation/pagination The Pagination component provides navigation controls for moving between pages of content. It displays page numbers, previous/next buttons, and handles page state. ## Installation ```bash shellui add pagination ``` ## Basic Usage ```razor @code { private int currentPage = 1; } ``` ## With Content Combine pagination with a data list: ```razor
@foreach (var item in GetPagedItems()) {

@item.Title

@item.Description

}
@code { private record Item(string Title, string Description); private const int pageSize = 3; private int currentPage = 1; private int totalPages => (int)Math.Ceiling(allItems.Count / (double)pageSize); private readonly List allItems = Enumerable.Range(1, 15) .Select(i => new Item($"Item {i}", $"Description for item {i}")) .ToList(); private List GetPagedItems() => allItems .Skip((currentPage - 1) * pageSize) .Take(pageSize) .ToList(); } ``` ## Dynamic Page Count Calculate total pages from data: ```razor @code { private int currentPage = 1; private int totalItems = 95; private int pageSize = 10; private async Task HandlePageChange(int page) { currentPage = page; await LoadData(); } private async Task LoadData() { // Fetch data for current page } } ``` ## Custom Styling ```razor @code { private int currentPage = 1; } ``` ## API Reference | Property | Type | Default | Description | |----------|------|---------|-------------| | `CurrentPage` | `int` | `1` | The active page number | | `CurrentPageChanged` | `EventCallback` | — | Callback when page changes | | `TotalPages` | `int` | `1` | Total number of pages | | `ClassName` | `string?` | `null` | Additional CSS classes | ## Accessibility The Pagination component includes: - `nav` element with `aria-label="pagination"` - `aria-current="page"` on the active page - Keyboard navigable with Tab and Enter - Previous/Next buttons with `aria-label` - Disabled state for first/last page boundaries