Pagination component for displaying page indicators.
Usage: (def pager (paginator :total-pages 5))
;; In update function: (paginator-update pager msg)
;; In view function: (paginator-view pager)
Pagination component for displaying page indicators. Usage: (def pager (paginator :total-pages 5)) ;; In update function: (paginator-update pager msg) ;; In view function: (paginator-view pager)
(items-on-page pager total-items)Get number of items on current page.
Get number of items on current page.
(on-first-page? pager)Check if on first page.
Check if on first page.
(on-last-page? pager)Check if on last page.
Check if on last page.
(paginator &
{:keys [total-pages per-page page type active-dot inactive-dot
arabic-format active-style inactive-style id]
:or {total-pages 1
per-page 1
page 0
type :dots
active-dot "•"
inactive-dot "○"
arabic-format "%d/%d"
id (rand-int 1000000)}})Create a paginator component.
Options: :total-pages - Total number of pages (default 1) :per-page - Items per page (default 1) :page - Current page, 0-indexed (default 0) :type - :dots or :arabic (default :dots) :active-dot - String for active page dot (default "•") :inactive-dot - String for inactive page dot (default "○") :arabic-format - Format string for arabic type (default "%d/%d") :active-style - Style for active indicator :inactive-style - Style for inactive indicator :id - Unique ID
Create a paginator component. Options: :total-pages - Total number of pages (default 1) :per-page - Items per page (default 1) :page - Current page, 0-indexed (default 0) :type - :dots or :arabic (default :dots) :active-dot - String for active page dot (default "•") :inactive-dot - String for inactive page dot (default "○") :arabic-format - Format string for arabic type (default "%d/%d") :active-style - Style for active indicator :inactive-style - Style for inactive indicator :id - Unique ID
(paginator-init pager)Initialize the paginator, returns [pager cmd].
Initialize the paginator, returns [pager cmd].
(paginator-update pager msg)Update paginator state based on a message. Returns [new-pager cmd] or [pager nil] if message not handled.
Update paginator state based on a message. Returns [new-pager cmd] or [pager nil] if message not handled.
(paginator-view pager)Render the paginator to a string.
Render the paginator to a string.
(set-total-items pager total-items)Set total pages based on item count.
Set total pages based on item count.
(slice-bounds pager total-items)Get [start end] bounds for slicing items for current page.
Get [start end] bounds for slicing items for current page.
(total-pages pager)Get total number of pages.
Get total number of pages.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |