Documentation
¶
Overview ¶
Package pagination renders a numeric pagination nav.
The component is fully server-rendered as a <nav> with aria-label "Pagination". Each page is an <a> link, with aria-current="page" on the active page. Adjacent pages and the first/last are always shown; intermediate gaps are rendered as a <span> ellipsis.
Hosts pass a HrefPattern (e.g. "/items?page=%d") used to build the link URL for each page number.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Style = registry.RegisterStyle("pagination", styleFn)
Style is the registered stylesheet handle. New's <nav> goes through Style.WrapHTML so the data-fui-comp marker is emitted and the runtime auto-loads the CSS on first appearance.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Total is the total number of pages.
Total int
// Current is the active page (1-indexed).
Current int
// HrefPattern is a Sprintf pattern with one %d placeholder for the
// page number. Required.
HrefPattern string
// Window is the number of pages to show on each side of Current.
// Default: 1 → previous, current, next plus first/last with ellipses.
Window int
// Label overrides the default "Pagination" aria-label.
Label string
// PrevLabel and NextLabel customize the prev/next link text.
// Defaults: "Previous" / "Next".
PrevLabel string
NextLabel string
// OmitPrevNext suppresses the prev/next anchors entirely.
OmitPrevNext bool
// IslandSignal turns this pagination into an island update trigger.
// When non-empty, every page link renders as a `<button
// data-fui-rpc="<endpoint>?<page-key>=N" data-fui-rpc-method="GET"
// data-fui-rpc-signal="<name>">N</button>` instead of an `<a href>`.
// Click → runtime fires the RPC → response replaces the signal-bound
// container. The server-side handler is responsible for returning
// the new HTML and (recommended) an `X-Gofastr-Push-State` header
// so the URL stays in sync.
//
// Pair with IslandEndpoint (the URL the buttons hit) for full island
// behavior. When unset, pagination falls back to plain <a href> links.
IslandSignal string
// IslandEndpoint is the URL the page-change RPC fires at. The HrefPattern's
// %d placeholder still encodes the page number — the runtime sends the
// resulting URL as the RPC path. Required when IslandSignal is set.
IslandEndpoint string
ID string
Class string
}
Config configures the pagination nav.
Click to show internal directories.
Click to hide internal directories.