Button Group
Record Navigator
A record navigator where jumping to an edge and stepping by one differ in icon shape, with a thin position bar under the cluster.
- buttongroup
- navigation
- records
- progress
Preview
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/buttongroup-043?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 "buttongroup-043" (Record Navigator) 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/buttongroup-043.json
Registry item: https://vibeui.ru/r/buttongroup-043.json
Installs to: components/vibeui/buttongroup-043.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
A record navigator where jumping to an edge and stepping by one differ in icon shape, with a thin position bar under the cluster.
A record navigator with edge jumps and a position bar. Zero dependencies, one file, a server component.
## 3. How to use it
import { Buttongroup043 } from "@/components/vibeui/buttongroup-043"
<Buttongroup043 index={12} total={340} entity="Record" label="Record navigation" />
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-buttongroup-043-* palette — do not swap it for your theme tokens
- the bar on the edge arrows: without it "first" and "previous" are indistinguishable
- disabling the buttons in pairs: on the first record both left buttons are meaningless
- the position bar — "12 of 340" is read but not felt
- aria-hidden on the bar, because the position is already spoken by the counter
- the tabular figures and min-width on the counter: crossing a hundred would otherwise jolt the buttons
## 6. You may change
- the current number through index
- the record count through total
- the counter noun through entity and the navigation name through label
- the bar and ring colour through accent
## 7. Rules
- The buttons carry no onClick: your code performs the move, the component shows the state.
- A disabled button drops out of the Tab order: standard behaviour, but focus will not rest on it.
- The counter is not inflected: "Record 12 of 340" needs its own wording per language.
- 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/buttongroup-043.jsonhttps://vibeui.ru/r/buttongroup-043.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в переменных --vibeui-buttongroup-043-*. Серверный: индекс приходит пропсом и зажимается в диапазон 1..total. Стрелка с планкой означает «до упора», стрелка без планки — «на шаг»: разница читается формой, а не подписью. Крайние кнопки гасятся парами — на первой записи бессмысленны обе левые. Полоса положения под сцепкой построена на процентной ширине от индекса и помечена aria-hidden, потому что то же самое сказано текстом «Запись 12 из 340». Счётчик набран табличными цифрами и имеет min-width, иначе переход через сотню дёргает кнопки. Рамка одна на треке, разделители рисует общий селектор > * + *.
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 Buttongroup043Props = Omit<
ComponentPropsWithoutRef<"nav">,
"children"
> & {
index?: number
total?: number
entity?: string
label?: string
accent?: string
}
// Идея компонента: навигация по записям карточной формы — первая, предыдущая,
// следующая, последняя. Переход к краю и переход на шаг различаются не
// подписью, а формой значка: стрелка с планкой упирается в стену. Под
// сцепкой лежит тонкая полоса положения: она показывает, где вы в наборе,
// когда «12 из 340» уже ничего не говорит. Полоса построена на процентной
// ширине от индекса и помечена aria-hidden — то же самое сказано текстом.
// Крайние кнопки гасятся disabled парами: на первой записи бессмысленны обе
// левые, и гасить только одну — значит обмануть.
const STYLES = `
:where([data-vibeui-block="buttongroup-043"]){
--vibeui-buttongroup-043-surface:oklch(1 0 0);
--vibeui-buttongroup-043-fg:oklch(0.25 0.016 265);
--vibeui-buttongroup-043-muted:oklch(0.56 0.014 265);
--vibeui-buttongroup-043-border:oklch(0.88 0.008 265);
--vibeui-buttongroup-043-accent:oklch(0.5 0.16 265);
--vibeui-buttongroup-043-radius:0.625rem;
--vibeui-buttongroup-043-progress:0%;
--vibeui-buttongroup-043-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="buttongroup-043"]{
box-sizing:border-box;display:inline-flex;flex-direction:column;gap:0.4375rem;
font-family:var(--vibeui-buttongroup-043-font);
}
[data-vibeui-block="buttongroup-043"] *{box-sizing:border-box}
[data-vibeui-block="buttongroup-043"] [data-part="track"]{
display:flex;isolation:isolate;
border:1px solid var(--vibeui-buttongroup-043-border);
border-radius:var(--vibeui-buttongroup-043-radius);
background:var(--vibeui-buttongroup-043-surface);
overflow:hidden;
}
[data-vibeui-block="buttongroup-043"] button{
appearance:none;cursor:pointer;font:inherit;
position:relative;z-index:0;
display:inline-flex;align-items:center;justify-content:center;
width:2.25rem;height:2.25rem;
border:0;background:transparent;
color:var(--vibeui-buttongroup-043-muted);
transition:background-color .16s ease,color .16s ease;
}
[data-vibeui-block="buttongroup-043"] [data-part="track"] > * + *{
border-inline-start:1px solid var(--vibeui-buttongroup-043-border);
}
[data-vibeui-block="buttongroup-043"] svg{
width:1rem;height:1rem;
stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;
}
[data-vibeui-block="buttongroup-043"] button:hover:not(:disabled){
background:oklch(0.965 0.005 265);color:var(--vibeui-buttongroup-043-fg);
}
[data-vibeui-block="buttongroup-043"] button:disabled{opacity:.32;cursor:not-allowed}
[data-vibeui-block="buttongroup-043"] button:focus-visible{
z-index:1;outline:2px solid var(--vibeui-buttongroup-043-accent);outline-offset:-2px;
}
[data-vibeui-block="buttongroup-043"] [data-part="counter"]{
display:inline-flex;align-items:center;justify-content:center;
min-width:5.5rem;height:2.25rem;padding:0 0.625rem;
color:var(--vibeui-buttongroup-043-fg);
font-size:0.8125rem;font-weight:650;line-height:1;
font-variant-numeric:tabular-nums;white-space:nowrap;
}
/* Полоса положения: «12 из 340» цифрами читается, но не ощущается. */
[data-vibeui-block="buttongroup-043"] [data-part="bar"]{
position:relative;height:3px;border-radius:2px;
background:oklch(0.93 0.006 265);overflow:hidden;
}
[data-vibeui-block="buttongroup-043"] [data-part="bar"] i{
position:absolute;inset-block:0;inset-inline-start:0;
width:var(--vibeui-buttongroup-043-progress);
border-radius:2px;background:var(--vibeui-buttongroup-043-accent);
transition:width .2s ease;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="buttongroup-043"] *{animation:none!important;transition:none!important}}
`
const ICONS = {
first: "M18 5 11 12l7 7M7 5v14",
prev: "M15 5l-7 7 7 7",
next: "M9 5l7 7-7 7",
last: "M6 5l7 7-7 7M17 5v14",
}
/**
* Навигация по записям: край и шаг различаются формой значка, снизу — полоса.
* Один файл, ноль зависимостей, серверный компонент.
*/
export function Buttongroup043({
index = 12,
total = 340,
entity = "Запись",
label = "Навигация по записям",
accent,
className,
style,
...props
}: Buttongroup043Props) {
const current = Math.min(Math.max(1, index), total)
const atStart = current === 1
const atEnd = current === total
const palette = {
"--vibeui-buttongroup-043-progress": `${total > 1 ? ((current - 1) / (total - 1)) * 100 : 100}%`,
...(accent ? { "--vibeui-buttongroup-043-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-buttongroup-043" precedence="medium">
{STYLES}
</style>
<nav
{...props}
data-vibeui-block="buttongroup-043"
className={className}
style={palette}
aria-label={label}
>
<div data-part="track">
<button type="button" disabled={atStart} aria-label="К первой записи">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d={ICONS.first} />
</svg>
</button>
<button
type="button"
disabled={atStart}
aria-label="К предыдущей записи"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d={ICONS.prev} />
</svg>
</button>
<span data-part="counter">
{entity} {current} из {total}
</span>
<button
type="button"
disabled={atEnd}
aria-label="К следующей записи"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d={ICONS.next} />
</svg>
</button>
<button
type="button"
disabled={atEnd}
aria-label="К последней записи"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d={ICONS.last} />
</svg>
</button>
</div>
<div data-part="bar" aria-hidden="true">
<i />
</div>
</nav>
</>
)
}