Navigation
Cursor Pagination
Cursor pagination: a row range instead of page numbers — it stays true while the data keeps changing.
- pagination
- cursor
- list
- range
Preview
1440pxHost theme
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/pagination-002?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "pagination-002" (Cursor Pagination) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/pagination-002.json
Registry item: https://vibeui.ru/r/pagination-002.json
Installs to: components/vibeui/pagination-002.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
Cursor pagination: a row range instead of page numbers — it stays true while the data keeps changing.
Cursor pagination: the row range on the left, Previous and Next on the right, muted at the edge of the list. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Pagination002 } from "@/components/vibeui/pagination-002"
<Pagination002 from={41} perPage={20} total={214} />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the local --vibeui-pagination-002-* palette — do not swap it for your theme tokens
- counting rows rather than pages: with changing data a page number lies
- aria-disabled at the edge instead of removing the button — otherwise the row jumps
- tabular figures in the range
- links rather than buttons: the page address must open in a new tab
- the border-drawn arrows: they rotate with the direction
## 6. You may change
- from, perPage and total
- prevHref and nextHref
- the accent through the accent prop
- the row width
## 7. Rules
- The component only shows the bounds: the cursor and the request stay in the caller.
- Page numbers are deliberately absent: for stable data with jump-to-page use pagination-001.
- pointer-events:none at the edge does not block keyboard activation — drop the href for a hard stop.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/pagination-002.jsonhttps://vibeui.ru/r/pagination-002.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-pagination-002-*. Серверный: хуков нет, границы считаются из пропсов. Край списка помечен aria-disabled на ссылке: кнопка остаётся на месте, но не работает, поэтому строка навигации не прыгает. Числа набраны табличными цифрами.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Pagination002Props = Omit<
ComponentPropsWithoutRef<"nav">,
"children"
> & {
/** Номер первой строки на экране: счёт ведут по строкам, а не по страницам. */
from?: number
perPage?: number
total?: number
prevHref?: string
nextHref?: string
accent?: string
}
// Идея компонента: курсорная навигация для длинных списков. Номеров страниц
// нет намеренно: при постоянно меняющихся данных страница №7 завтра покажет
// другие строки, а «строки 41–60 из 214» остаётся правдой. Край списка
// закрывает недоступную кнопку через aria-disabled на ссылке: убирать её
// нельзя, иначе строка навигации прыгает.
const STYLES = `
:where([data-vibeui-block="pagination-002"]){
--vibeui-pagination-002-bg:oklch(1 0 0);
--vibeui-pagination-002-fg:oklch(0.24 0.014 265);
--vibeui-pagination-002-muted:oklch(0.56 0.014 265);
--vibeui-pagination-002-border:oklch(0.9 0.006 265);
--vibeui-pagination-002-hover:oklch(0.55 0.02 265 / 8%);
--vibeui-pagination-002-accent:oklch(0.55 0.2 262);
--vibeui-pagination-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="pagination-002"]{
display:flex;align-items:center;justify-content:space-between;gap:1rem;
width:100%;max-width:26rem;box-sizing:border-box;padding:0.5rem 0.625rem;
background:var(--vibeui-pagination-002-bg);
border:1px solid var(--vibeui-pagination-002-border);border-radius:0.75rem;
font-family:var(--vibeui-pagination-002-font);color:var(--vibeui-pagination-002-fg);
}
/* Счёт по строкам: он остаётся верным, даже когда данные меняются. */
[data-vibeui-block="pagination-002"] [data-part="range"]{
font-size:0.8125rem;color:var(--vibeui-pagination-002-muted);
font-variant-numeric:tabular-nums;
}
[data-vibeui-block="pagination-002"] [data-part="range"] b{color:var(--vibeui-pagination-002-fg);font-weight:650}
[data-vibeui-block="pagination-002"] [data-part="side"]{display:flex;align-items:center;gap:0.375rem}
[data-vibeui-block="pagination-002"] [data-part="step"]{
display:inline-flex;align-items:center;gap:0.375rem;
height:2rem;padding:0 0.625rem;border-radius:0.5rem;
border:1px solid var(--vibeui-pagination-002-border);
color:inherit;text-decoration:none;font-size:0.8125rem;
}
[data-vibeui-block="pagination-002"] [data-part="step"]:hover{background:var(--vibeui-pagination-002-hover)}
[data-vibeui-block="pagination-002"] [data-part="step"]:focus-visible{outline:2px solid var(--vibeui-pagination-002-accent);outline-offset:2px}
/* Край списка: кнопка остаётся на месте, но не работает — строка не прыгает. */
[data-vibeui-block="pagination-002"] [data-part="step"][aria-disabled="true"]{
color:var(--vibeui-pagination-002-muted);pointer-events:none;opacity:.55;
}
[data-vibeui-block="pagination-002"] [data-part="arrow"]{
width:0.375rem;height:0.375rem;
border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;
}
[data-vibeui-block="pagination-002"] [data-part="step"][data-dir="prev"] [data-part="arrow"]{transform:rotate(135deg)}
[data-vibeui-block="pagination-002"] [data-part="step"][data-dir="next"] [data-part="arrow"]{transform:rotate(-45deg)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="pagination-002"] *{animation:none!important;transition:none!important}}
`
/**
* Курсорная навигация: диапазон строк вместо номеров страниц.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Pagination002({
from = 41,
perPage = 20,
total = 214,
prevHref = "#",
nextHref = "#",
accent,
className,
style,
...props
}: Pagination002Props) {
const to = Math.min(from + perPage - 1, total)
const atStart = from <= 1
const atEnd = to >= total
const palette = {
...(accent ? { "--vibeui-pagination-002-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-pagination-002" precedence="medium">
{STYLES}
</style>
<nav
{...props}
data-vibeui-block="pagination-002"
aria-label="Навигация по списку"
className={className}
style={palette}
>
<p data-part="range">
Строки{" "}
<b>
{from}–{to}
</b>{" "}
из {total}
</p>
<div data-part="side">
<a
data-part="step"
data-dir="prev"
href={prevHref}
aria-disabled={atStart || undefined}
>
<span data-part="arrow" aria-hidden="true" />
Назад
</a>
<a
data-part="step"
data-dir="next"
href={nextHref}
aria-disabled={atEnd || undefined}
>
Вперёд
<span data-part="arrow" aria-hidden="true" />
</a>
</div>
</nav>
</>
)
}