Button Group
Busy Segment
An action cluster with one button busy: the caption fades, the ring lands in the same grid cell, and the group's width never changes.
- buttongroup
- loading
- aria-busy
- actions
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-032?lang=en
Validating, this takes a few seconds
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-032" (Busy Segment) 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-032.json
Registry item: https://vibeui.ru/r/buttongroup-032.json
Installs to: components/vibeui/buttongroup-032.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
An action cluster with one button busy: the caption fades, the ring lands in the same grid cell, and the group's width never changes.
An action group with one busy button of constant width and a spoken state. Zero dependencies, one file, a server component.
## 3. How to use it
import { Buttongroup032 } from "@/components/vibeui/buttongroup-032"
<Buttongroup032
actions={["Save", "Validate", "Publish"]}
busy="Validate"
busyLabel="Validating"
label="Document actions"
/>
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-032-* palette — do not swap it for your theme tokens
- the caption and the ring in one grid cell: swapping the text for "Saving…" would stretch the group on every request
- aria-busy alongside disabled — otherwise the busy button reads as broken
- the role="status" live region: a spinning ring does not exist for a screen reader
- disabled only on the busy button: the other actions must stay available
- the prefers-reduced-motion rule — an endless spin is the first thing to hurt with vestibular disorders
## 6. You may change
- the set of actions through actions
- the caption of the busy button through busy
- the progress text through busyLabel and the group name through label
- the ring and focus colour through accent
## 7. Rules
- busy is matched against an action caption: a typo silently leaves the group without an indicator.
- The component starts no requests: the busy state comes from outside and is changed by your code.
- The ring spins for as long as busy is non-empty: remember to clear it once the server answers.
- 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-032.jsonhttps://vibeui.ru/r/buttongroup-032.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в переменных --vibeui-buttongroup-032-*. Серверный: занятость приходит пропсом busy, хуков нет. Кнопка выложена display:grid, подпись и кольцо занимают одну и ту же ячейку (grid-area:1 / 1), поэтому подмена текста на «Сохраняю…» не растягивает группу — меняется только прозрачность. Занятая кнопка получает aria-busy и disabled: disabled убирает повторное нажатие, aria-busy объясняет, что кнопка не сломана. Живая область role="status" сообщает о работе словами — крутящееся кольцо незрячему не видно. Анимация вращения описана @keyframes и гасится правилом prefers-reduced-motion.
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 Buttongroup032Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
actions?: string[]
busy?: string
busyLabel?: string
label?: string
accent?: string
}
// Идея компонента: одна кнопка сцепки занята работой, остальные живы.
// Ширина занятой кнопки не меняется: подпись остаётся на месте и получает
// opacity:0, а колечко ложится поверх неё в grid-area того же трека — при
// подмене текста на «Сохраняю…» группа дёргалась бы на каждый запрос.
// Кнопка помечена aria-busy и disabled: disabled убирает повторное нажатие,
// aria-busy объясняет, что кнопка не сломана, а занята. Живая область
// role="status" сообщает о начале работы словами — крутящееся кольцо
// незрячему не видно.
const STYLES = `
:where([data-vibeui-block="buttongroup-032"]){
--vibeui-buttongroup-032-surface:oklch(1 0 0);
--vibeui-buttongroup-032-fg:oklch(0.25 0.016 265);
--vibeui-buttongroup-032-muted:oklch(0.55 0.014 265);
--vibeui-buttongroup-032-border:oklch(0.88 0.008 265);
--vibeui-buttongroup-032-accent:oklch(0.52 0.16 265);
--vibeui-buttongroup-032-radius:0.625rem;
--vibeui-buttongroup-032-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="buttongroup-032"]{
box-sizing:border-box;display:inline-flex;flex-direction:column;gap:0.5rem;
font-family:var(--vibeui-buttongroup-032-font);
}
[data-vibeui-block="buttongroup-032"] *{box-sizing:border-box}
[data-vibeui-block="buttongroup-032"] [data-part="track"]{
display:flex;isolation:isolate;
border:1px solid var(--vibeui-buttongroup-032-border);
border-radius:var(--vibeui-buttongroup-032-radius);
background:var(--vibeui-buttongroup-032-surface);
overflow:hidden;
}
[data-vibeui-block="buttongroup-032"] button{
appearance:none;cursor:pointer;font:inherit;
position:relative;z-index:0;display:grid;place-items:center;
height:2.375rem;padding:0 0.875rem;
border:0;background:transparent;
color:var(--vibeui-buttongroup-032-fg);
font-size:0.8125rem;font-weight:600;line-height:1;white-space:nowrap;
transition:background-color .16s ease;
}
[data-vibeui-block="buttongroup-032"] button + button{
border-inline-start:1px solid var(--vibeui-buttongroup-032-border);
}
[data-vibeui-block="buttongroup-032"] button:hover:not(:disabled){background:oklch(0.965 0.005 265)}
[data-vibeui-block="buttongroup-032"] button:focus-visible{
z-index:1;outline:2px solid var(--vibeui-buttongroup-032-accent);outline-offset:-2px;
}
/* Подпись и кольцо лежат в одной ячейке grid: ширина не прыгает. */
[data-vibeui-block="buttongroup-032"] [data-part="text"],
[data-vibeui-block="buttongroup-032"] [data-part="spinner"]{grid-area:1 / 1}
[data-vibeui-block="buttongroup-032"] [data-part="spinner"]{
width:1rem;height:1rem;border-radius:9999px;opacity:0;
border:2px solid oklch(0.85 0.01 265);
border-top-color:var(--vibeui-buttongroup-032-accent);
animation:vibeui-buttongroup-032-spin .7s linear infinite;
}
[data-vibeui-block="buttongroup-032"] [data-busy="true"]{
cursor:progress;color:var(--vibeui-buttongroup-032-muted);
background:oklch(0.975 0.004 265);
}
[data-vibeui-block="buttongroup-032"] [data-busy="true"] [data-part="text"]{opacity:0}
[data-vibeui-block="buttongroup-032"] [data-busy="true"] [data-part="spinner"]{opacity:1}
@keyframes vibeui-buttongroup-032-spin{to{transform:rotate(360deg)}}
[data-vibeui-block="buttongroup-032"] [data-part="status"]{
margin:0;min-height:1.0625rem;
color:var(--vibeui-buttongroup-032-muted);
font-size:0.75rem;line-height:1.4;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="buttongroup-032"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_ACTIONS = ["Сохранить", "Проверить", "Опубликовать"]
/**
* Сцепка действий, где одна кнопка занята работой, а её ширина не меняется.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Buttongroup032({
actions = DEFAULT_ACTIONS,
busy = "Проверить",
busyLabel = "Идёт проверка, это займёт несколько секунд",
label = "Действия над документом",
accent,
className,
style,
...props
}: Buttongroup032Props) {
const palette = {
...(accent ? { "--vibeui-buttongroup-032-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-buttongroup-032" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="buttongroup-032"
className={className}
style={palette}
>
<div data-part="track" role="group" aria-label={label}>
{actions.map((action) => {
const working = action === busy
return (
<button
key={action}
type="button"
data-busy={working}
aria-busy={working}
disabled={working}
>
<span data-part="text">{action}</span>
<span data-part="spinner" aria-hidden="true" />
</button>
)
})}
</div>
<p data-part="status" role="status">
{busy ? busyLabel : ""}
</p>
</div>
</>
)
}