Skip to main content
twblazor
Home
  • Get started
  • Tailwind with Blazor
  • Why twblazor?
  • Theme
  • Class Merge
    • Configuring localization
    • RTL Provider
  • Breadcrumb
  • Card
  • Carousel
  • Collapse
  • Context Menu
  • Drawer
  • Footer
  • Menu
  • Navbar
  • On This Page
  • Separator
  • Sidebar
  • Stepper
  • Tabs
  • Tree List
  • Container
  • Flex
  • Grid
  • Text
  • Link
  • Button
  • Form
    • AutocompleteNew
    • Checkbox
    • Color Picker
    • Date Picker
    • Date Range Picker
    • Datetime Picker
    • Datetime Range Picker
    • File Upload
    • Input GroupNew
    • NumericNew
    • Masked InputNew
    • Radio Button
    • Range SliderNew
    • RatingNew
    • Select
    • Slider
    • Switch
    • Tag InputNew
    • Text EditorNew
    • Textfield
    • Time Picker
    • Time Range Picker
  • Toggle
  • Toggle Group
  • Alert
  • Avatar
  • Badge
  • Chip
  • Empty
  • Icon
  • Popover
  • Progress
  • Skeleton
  • Spinner
  • Tooltip
  • Data Table
  • SpreadsheetNew
  • Column Filter Editor
  • Pagination
  • Pick List
  • Barcode
  • QR Code
  • Calendar
  • Table
  • Attachment
  • Overview
    • Bar
    • Bullet
    • Column
    • Dot Plot
    • Dumbbell
    • Icon
    • Lollipop
    • Radial Bar
    • Range
    • Word Cloud
    • Area
    • Bump
    • Bump Area
    • Candlestick
    • Gantt
    • Horizon
    • Line
    • Slope
    • Small Multiples
    • Stream Graph
    • Funnel
    • Gauge
    • Marimekko
    • Nightingale
    • Pie
    • Treemap
    • Waffle
    • Waterfall
    • Circular Treemap
    • Convex Treemap
    • Dendrogram
    • Sunburst
    • Barcode
    • Beeswarm
    • Box Plot
    • Density Plot
    • Histogram
    • Radial Histogram
    • Ridgeline
    • Strip Plot
    • Violin Plot
    • Categorical Scatter
    • Contour
    • Hexagonal Binning
    • Quadrant
    • Scatter
    • Heatmap
    • Matrix
    • Parallel Coordinates
    • Radar
    • Arc Diagram
    • Chord Diagram
    • Flowchart
    • Network Diagram
    • Sankey
    • Euler Diagram
    • Venn Diagram
  • Bubble
  • Marker
  • Message
  • Dialog Service
  • Toast Service
API DocumentationAI Agents & Skills
Home Get Started

Data

TwPagination

TwPagination is a Blazor pagination component. Bind ActivePage and PageSize, set TotalPages and ShowPageSize to split content across pages.

Last updated 6 October 2026

Basic usage

Bind ActivePage to track the current page as the user clicks between pages. TotalPages controls how many pages are available.

Page 1 of 10

RAZOR
<TwPagination TotalPages="10" @bind-ActivePage="activePage" AriaLabel="Basic pagination" />
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">Page <strong>@activePage</strong> of <strong>10</strong></p>
CSHARP
@code {
    private int activePage = 1;
}

Responding to page changes

Use ActivePageChanged instead of two-way binding when you need to run logic - such as loading new data - whenever the page changes.

Showing results for page 1.

RAZOR
<TwPagination TotalPages="6" ActivePage="pageChangedActivePage" ActivePageChanged="OnActivePageChanged" AriaLabel="Pagination with change handler" />
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">@pageChangedMessage</p>
CSHARP
@code {
    private int pageChangedActivePage = 1;
    private string pageChangedMessage = "Showing results for page 1.";
    
    private void OnActivePageChanged(int page)
    {
        pageChangedActivePage = page;
        pageChangedMessage = $"Showing results for page {page}.";
    }
}

Dense

Set Dense to render smaller, more compact buttons, useful for tight layouts such as beneath a table. The optional page size selector becomes dense too.
RAZOR
<TwPagination TotalPages="10" Dense="true" @bind-ActivePage="denseActivePage" ShowPageSize="true" @bind-PageSize="densePageSize" AriaLabel="Dense pagination" />
CSHARP
@code {
    private int denseActivePage = 1;
    private int densePageSize = 10;
}

Page size selector

Set ShowPageSize to add an optional "items per page" dropdown alongside the pagination controls. Bind PageSize and customize PageSizeOptions to control the available choices.

Page 1 of 12, showing 10 items per page.

RAZOR
<TwPagination TotalPages="12" @bind-ActivePage="pageSizeActivePage" ShowPageSize="true" @bind-PageSize="pageSize" AriaLabel="Pagination with page size selector" />
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">Page <strong>@pageSizeActivePage</strong> of 12, showing <strong>@pageSize</strong> items per page.</p>
CSHARP
@code {
    private int pageSizeActivePage = 1;
    private int pageSize = 10;
}

Keyboard navigation

The pagination is a navigation landmark. The previous and next buttons stay focusable on the first and last page, where they are announced as unavailable.
Key What it does
Tab or Shift+ plus Tab Moves between the previous button, the page buttons, the next button and the page size list.
Enter or Space Goes to that page. The new page number is announced.

Theme configuration

Styling is controlled by TwBlazorTheme.Components (a TwPaginationTheme), configured via the AddTwBlazor() options callback described on the Get Started page. Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Property Type Controls
List string
Base string
Size string
DenseSize string
Buttons string
ActiveButton string
DisabledButton string

Full reference: TwPaginationTheme on the API docs.

On this page

  • Basic usage
  • Responding to page changes
  • Dense
  • Page size selector
  • Keyboard navigation
  • Theme configuration
twblazor

The Tailwind CSS component library for Blazor. Accessible, themeable and MIT licensed.

Discord (opens in a new tab) GitHub(opens in a new tab)

Get started

  • Install guide
  • Theming
  • Class merging
  • Localization

Guides

  • Tailwind CSS with Blazor
  • Why twblazor?
  • Right to left
  • AI agents and skills

Resources

  • API documentation (opens in a new tab)
  • llms.txt (opens in a new tab)
  • MIT License (opens in a new tab)

Community

  • Contributing (opens in a new tab)
  • Code of conduct (opens in a new tab)
  • Report an issue (opens in a new tab)

twblazor is and always will be free and open source.

An unhandled error has occurred. Reload