mostlylucid.pagingtaghelper
0.1.1
See the version list below for details.
dotnet add package mostlylucid.pagingtaghelper --version 0.1.1
NuGet\Install-Package mostlylucid.pagingtaghelper -Version 0.1.1
<PackageReference Include="mostlylucid.pagingtaghelper" Version="0.1.1" />
<PackageVersion Include="mostlylucid.pagingtaghelper" Version="0.1.1" />
<PackageReference Include="mostlylucid.pagingtaghelper" />
paket add mostlylucid.pagingtaghelper --version 0.1.1
#r "nuget: mostlylucid.pagingtaghelper, 0.1.1"
#addin nuget:?package=mostlylucid.pagingtaghelper&version=0.1.1
#tool nuget:?package=mostlylucid.pagingtaghelper&version=0.1.1
mostlylucid paging tag helper and viewcomponent.
This is a preview of this tag helper at present but it works. I'll be adding more documentation and samples as I go.
Installation
You can install the package via nuget:
dotnet add package mostlylucid.pagingtaghelper
Usage
I am currently building a sample porject here (I'll host the sample site later). You can view the source for the sample site here:
- Basic use without HTMX - this sample shoows the very basic usage of the tag helper. It disables HTMX using the
use-htmx
property set to false.
<paging model="Model"
use-htmx="false"
class="mt-4">
</paging>
It also uses the JavaScript snippet below to handle the form submission:
@Html.PageSizeOnchangeSnippet()
This can be added anywhere.
It takes a PagerViewModel
which contains the following:
using mostlylucid.pagingtaghelper.Models;
namespace mostlylucid.pagingtaghelper.Components;
public class PagerViewModel
{
public IPagingModel? Model { get; set; }
public bool UseLocalView { get; set; } = false;
public bool UseHtmx { get; set; } = true;
public string? PagerId { get; set; }
public bool ShowPageSize { get; set; } = true;
public string? SearchTerm { get; set; }
// Required properties
public string? LinkUrl { get; set; }
public int? Page { get; set; }
public int? PageSize { get; set; }
public int? TotalItems { get; set; }
// Optional properties with defaults (using DaisyUI/Tailwind classes)
public int PagesToDisplay { get; set; } = 5;
public string CssClass { get; set; } = "btn-group"; // DaisyUI grouping style
public string FirstPageText { get; set; } = "«";
public string PreviousPageText { get; set; } = "‹ Previous";
public string SkipBackText { get; set; } = "..";
public string SkipForwardText { get; set; } = "..";
public string NextPageText { get; set; } = "Next ›";
public string NextPageAriaLabel { get; set; } = "go to next page";
public string LastPageText { get; set; } = "»";
public bool FirstLastNavigation { get; set; } = true;
public bool SkipForwardBackNavigation { get; set; } = true;
// Calculated value
public int TotalPages { get; set; }
// Optional htmx integration:
// If set (e.g. "#content"), pagination links will include htmx attributes.
public string HtmxTarget { get; set; } = "";
}
This defines all the configuration options for the tag helper.
NOTE: As it stands this site uses DaisyUI with TailwindCSS; later I'll document how to use it with any CSS framework.
- Use with HTMX - this sample shows how to use the tag helper with HTMX. It uses the same
PagerViewModel
as the basic sample but with theUseHtmx
property set totrue
.
<paging hx-boost="true"
class="mt-4"
hx-indicator="#loading-modal"
hx-target="#list"
hx-swap="show:none"
hx-headers='{"pagerequest": "true"}'
model="@Model">
</paging>
The tag helper is designed to preserve the hx
attributes and these cascade into the tag helper. The form submission is then handled using HTMX.
TBC
Additionally I'll write some blog posts over on my site about how to use this tag helper in a real-world scenario as welll as detail the thinking behind it's creation etc.
ViewComponent - one aspect of this is I use a ViewComponent in conjuntion with a tag helper; this pemits me to use the tag helper in a more dynamic way (for instance you can replace the Default view with your own custom view).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 0.1.1)
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 0.1.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.9.4.1 | 165 | 4/27/2025 |
0.9.4 | 219 | 4/26/2025 |
0.9.2 | 94 | 4/26/2025 |
0.9.1 | 908 | 3/24/2025 |
0.9.0 | 106 | 3/21/2025 |
0.8.9 | 84 | 3/21/2025 |
0.8.8 | 144 | 3/20/2025 |
0.8.7 | 144 | 3/20/2025 |
0.8.6 | 137 | 3/20/2025 |
0.7.1 | 146 | 3/20/2025 |
0.7.0 | 138 | 3/20/2025 |
0.6.3 | 150 | 3/18/2025 |
0.6.2 | 136 | 3/18/2025 |
0.6.1 | 140 | 3/17/2025 |
0.6.0 | 136 | 3/17/2025 |
0.5.1 | 142 | 3/17/2025 |
0.5.0 | 142 | 3/17/2025 |
0.4.0 | 147 | 3/13/2025 |
0.3.2 | 147 | 3/12/2025 |
0.3.1 | 150 | 3/12/2025 |
0.3.0 | 147 | 3/12/2025 |
0.2.0 | 151 | 3/11/2025 |
0.1.1 | 156 | 3/10/2025 |
0.1.0 | 148 | 3/10/2025 |
0.0.4 | 151 | 3/10/2025 |
0.0.3 | 153 | 3/10/2025 |
1.0
The mostlylucid paging tag helper AND View Component enables simple paging of data in ASP.NET Core applications.