UI components · Composed · new in 0.7
SpPagination
Previous and next, first and last, a window around the current page (heightened); on_change(page). Group: Composed · new in silverpoint 0.7, in React, Vue, Angular and Reflex (sp_pagination).
Live
Drawn here with the Reflex version, sp_pagination, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { useState } from 'react';
import { SpPagination } from '@silverpoint/react/ui/pagination';
export function Pages() {
const [page, setPage] = useState(3);
// total: items in all pages; pageSize defaults to 10. onChange receives the page number.
return <SpPagination total={240} current={page} onChange={setPage} showTotal />;
}<script setup lang="ts">
import { ref } from 'vue';
import { SpPagination } from '@silverpoint/vue/ui/pagination';
const page = ref(3);
</script>
<template>
<SpPagination v-model:current="page" :total="240" show-total />
</template>import { Component, signal } from '@angular/core';
import { SpPagination } from '@silverpoint/angular/ui/pagination';
@Component({
selector: 'app-pages',
imports: [SpPagination],
template: `<sp-pagination [(current)]="page" [total]="240" [showTotal]="true" />`,
})
export class Pages {
protected readonly page = signal(3);
}sp_pagination(
total=240, # items in all pages; page_size=10 by default
current=State.page,
on_change=State.set_page, # receives the page number
show_total=True, # "21–30 of 240"
)Import
Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you. Every adapter also exports it from the ui barrel.
| Framework | Import |
|---|---|
| React | import { SpPagination } from '@silverpoint/react/ui/pagination'; |
| Vue | import { SpPagination } from '@silverpoint/vue/ui/pagination'; |
| Angular | import { SpPagination } from '@silverpoint/angular/ui/pagination'; · sp-pagination |
| Reflex | from reflex_silverpoint_react import sp_pagination |
Events, values and slots
Each framework's own way. A change carries the new value itself (a key, a page, a number, a bool), never a DOM event.
| React | Vue | Angular | Reflex | |
|---|---|---|---|---|
| Page | current + onChange(page), or defaultCurrent | v-model:current | [(current)] | current + on_change |
Props
| React / Angular | Vue | Type | Description |
|---|---|---|---|
total required | total | number | The number of items paged over. |
pageSize | page-size | number | Default 10. |
siblings | siblings | number | Pages shown on each side of the current one. Default 1. |
showTotal | show-total | boolean | Default false. |
totalTemplate | total-template | string | Default '{start}–{end} of {total}'. |
label | label | string | Default 'Pagination'. |
previousLabel | previous-label | string | Default 'Previous page'. |
nextLabel | next-label | string | Default 'Next page'. |
pageLabel | page-label | string | Default 'Page'. |
disabled | disabled | boolean | Every page button disabled. |
In Reflex the names are snake_case; the Reflex column of Composed components shows the builder's arguments.
Common props
Every UI component also takes these, falling back to the dashboard it sits in, then to the provider. In Reflex they read silverpoint_provider too; only sp_trigger does not: pass them to it.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
id | id | id | str | The frame variant and every related id derive from it. |
ground | ground | ground | Literal['silverpoint', 'cyanotype'] | str | dict[str, Any] | Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint. |
substrate | substrate | substrate | Literal['cream', 'green', 'blue', 'ochre', 'prussian'] | Prepared substrate within the ground. |
mode | mode | mode | Literal['ink', 'precision'] | ink by default; precision disables inking. |
seed | seed | seed | str | int | Seed of the frame's hand; overrides id for the frame variant only. |
size | size | size | Literal['sm', 'md', 'lg'] | Control size: sm, md (default) or lg. |
palette | palette | palette | dict[str, str] | Colours over the ground's (set with palette=), merged over the dashboard's and the provider's. |
className | class-name | class_name | str | Added to the component's root element, after its own classes. |
palette | palette | palette | Palette | Colours over the ground's, merged over the dashboard's and the provider's. |
Report it
Found something wrong with SpPagination? Open an issue on GitHub — the form comes pre-filled with the component and the version.