Component Detail

Pagination

Previous/next pager with current page state

Example

References

Template
templates/components/pagination.tmpl
Golden
testdata/golden/pagination.golden.html

Go (Marionette) Example

This implementation example uses Marionette in Go. Source: docs/site-astro/public/examples/go/pagination.go

package goexamples

import (
	mb "github.com/YoshihideShirai/marionette/backend"
	mf "github.com/YoshihideShirai/marionette/frontend"
)

func RegisterPaginationExample(app *mb.App) {
	app.Page("/pagination", func(ctx *mb.Context) mf.Node {
		return mf.Pagination(mf.PaginationProps{
			Page:       2,
			TotalPages: 4,
			PrevHref:   "/users?page=1",
			NextHref:   "/users?page=3",
		})
	})
}