Documentation
¶
Overview ¶
Package pagination provides pagination components following shadcn/ui patterns. Pagination uses Alpine.js for state management and page navigation.
Index ¶
- func Ellipsis() g.Node
- func FirstButton() g.Node
- func LastButton() g.Node
- func NextButton() g.Node
- func PageButton(page int) g.Node
- func Pagination(opts ...Option) g.Node
- func PrevButton() g.Node
- type Option
- func WithAttrs(attrs ...g.Node) Option
- func WithClass(class string) Option
- func WithCurrentPage(page int) Option
- func WithOnPageChange(expr string) Option
- func WithShowFirstLast(show bool) Option
- func WithShowPrevNext(show bool) Option
- func WithSiblingCount(count int) Option
- func WithTotalPages(total int) Option
- type PaginationProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pagination ¶
Pagination creates a pagination component
Example:
pagination.Pagination(
pagination.WithCurrentPage(3),
pagination.WithTotalPages(10),
pagination.WithSiblingCount(1),
)
Types ¶
type Option ¶
type Option func(*PaginationProps)
Option is a functional option for configuring pagination
func WithCurrentPage ¶
WithCurrentPage sets the current active page
func WithOnPageChange ¶
WithOnPageChange sets the callback for page changes (Alpine expression)
func WithShowFirstLast ¶
WithShowFirstLast enables first/last page buttons
func WithShowPrevNext ¶
WithShowPrevNext enables previous/next buttons
func WithSiblingCount ¶
WithSiblingCount sets pages shown around current page
func WithTotalPages ¶
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
Click to show internal directories.
Click to hide internal directories.