pagination

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pagination provides pagination components following shadcn/ui patterns. Pagination uses Alpine.js for state management and page navigation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ellipsis

func Ellipsis() g.Node

Ellipsis creates an ellipsis indicator for collapsed pages

func FirstButton

func FirstButton() g.Node

FirstButton creates a "go to first page" button

func LastButton

func LastButton() g.Node

LastButton creates a "go to last page" button

func NextButton

func NextButton() g.Node

NextButton creates a "next page" button

func PageButton

func PageButton(page int) g.Node

PageButton creates a page number button

func Pagination

func Pagination(opts ...Option) g.Node

Pagination creates a pagination component

Example:

pagination.Pagination(
    pagination.WithCurrentPage(3),
    pagination.WithTotalPages(10),
    pagination.WithSiblingCount(1),
)

func PrevButton

func PrevButton() g.Node

PrevButton creates a "previous page" button

Types

type Option

type Option func(*PaginationProps)

Option is a functional option for configuring pagination

func WithAttrs

func WithAttrs(attrs ...g.Node) Option

WithAttrs adds custom attributes

func WithClass

func WithClass(class string) Option

WithClass adds custom classes

func WithCurrentPage

func WithCurrentPage(page int) Option

WithCurrentPage sets the current active page

func WithOnPageChange

func WithOnPageChange(expr string) Option

WithOnPageChange sets the callback for page changes (Alpine expression)

func WithShowFirstLast

func WithShowFirstLast(show bool) Option

WithShowFirstLast enables first/last page buttons

func WithShowPrevNext

func WithShowPrevNext(show bool) Option

WithShowPrevNext enables previous/next buttons

func WithSiblingCount

func WithSiblingCount(count int) Option

WithSiblingCount sets pages shown around current page

func WithTotalPages

func WithTotalPages(total int) Option

WithTotalPages sets the total number of pages

type PaginationProps

type PaginationProps struct {
	CurrentPage   int
	TotalPages    int
	SiblingCount  int  // Pages shown on each side of current page
	ShowFirstLast bool // Show first/last page buttons
	ShowPrevNext  bool // Show previous/next buttons
	OnPageChange  string
	Class         string
	Attrs         []g.Node
}

PaginationProps defines pagination configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL