Button Group
Share Rail
A share cluster with the link visible as its own cell: people send it with their eyes before they press anything.
- buttongroup
- share
- copy
- truncate
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-040?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-040" (Share Rail) 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-040.json
Registry item: https://vibeui.ru/r/buttongroup-040.json
Installs to: components/vibeui/buttongroup-040.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 share cluster with the link visible as its own cell: people send it with their eyes before they press anything.
A share cluster with the link in a cell and copy as the primary button. Zero dependencies, one file, a server component.
## 3. How to use it
import { Buttongroup040 } from "@/components/vibeui/buttongroup-040"
<Buttongroup040
link="vibeui.dev/r/buttongroup-040"
copyLabel="Copy"
targets={["mail", "chat", "qr"]}
label="Share the link"
/>
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-040-* palette — do not swap it for your theme tokens
- the visible link inside the cluster: the user has to see what is about to travel
- flex:none on the buttons and min-width:0 on the link — otherwise the tap targets disappear first
- the emphasis on copy: it is the most frequent action and must not look like the icons
- aria-label on the target buttons — a bare icon has no accessible name
- outline-offset:-2px on focus: an outside ring would be clipped by the container border
## 6. You may change
- the address in the cell through link
- the copy caption through copyLabel
- the set of targets through targets and the group name through label
- the primary button colour through accent
## 7. Rules
- Copying to the clipboard is not implemented: wire your handler at install time.
- Icons live as paths in ICONS: an unknown id silently falls back to the mail glyph.
- A long link is truncated at the end — the domain stays visible, the tail does not; showing the tail needs custom logic.
- 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-040.jsonhttps://vibeui.ru/r/buttongroup-040.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в переменных --vibeui-buttongroup-040-*. Серверный: хуков нет. Ячейка ссылки получает flex:1 1 auto с min-width:0 и text-overflow:ellipsis, а кнопки — flex:none: на узкой ширине сжимается текст, а не цели нажатия. Копирование выделено мягкой заливкой и подписью, остальные цели — квадратные ячейки со значками и aria-label. Рамка одна — на контейнере, разделители рисует border-inline-start у кнопок, углы обрезает overflow:hidden. Обводка фокуса уведена внутрь через outline-offset:-2px, иначе её срежет рамка контейнера.
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 Buttongroup040Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
link?: string
copyLabel?: string
targets?: string[]
label?: string
accent?: string
}
// Идея компонента: группа шеринга, в которой самая частая цель — скопировать
// ссылку — занимает не значок, а всю ширину. Ссылка показана прямо в сцепке
// отдельной ячейкой: люди отправляют её глазами раньше, чем нажимают кнопку,
// и должны видеть, что именно уедет. Ячейка ссылки сжимается (min-width:0 и
// text-overflow), а кнопки-цели не сжимаются вовсе — иначе на узкой ширине
// первым пропал бы значок, а не текст, и группа перестала бы работать.
const STYLES = `
:where([data-vibeui-block="buttongroup-040"]){
--vibeui-buttongroup-040-surface:oklch(1 0 0);
--vibeui-buttongroup-040-fg:oklch(0.25 0.016 265);
--vibeui-buttongroup-040-muted:oklch(0.56 0.014 265);
--vibeui-buttongroup-040-border:oklch(0.88 0.008 265);
--vibeui-buttongroup-040-accent:oklch(0.5 0.16 265);
--vibeui-buttongroup-040-radius:0.625rem;
--vibeui-buttongroup-040-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="buttongroup-040"]{
box-sizing:border-box;display:flex;align-items:stretch;isolation:isolate;
width:100%;max-width:26rem;
border:1px solid var(--vibeui-buttongroup-040-border);
border-radius:var(--vibeui-buttongroup-040-radius);
background:var(--vibeui-buttongroup-040-surface);
overflow:hidden;
font-family:var(--vibeui-buttongroup-040-font);
}
[data-vibeui-block="buttongroup-040"] *{box-sizing:border-box}
/* Ячейка ссылки сжимается, кнопки — нет. */
[data-vibeui-block="buttongroup-040"] [data-part="link"]{
flex:1 1 auto;min-width:0;
display:flex;align-items:center;
height:2.5rem;padding:0 0.75rem;
color:var(--vibeui-buttongroup-040-muted);
font-size:0.8125rem;line-height:1;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
[data-vibeui-block="buttongroup-040"] button{
appearance:none;cursor:pointer;font:inherit;flex:none;
position:relative;z-index:0;
display:inline-flex;align-items:center;justify-content:center;gap:0.375rem;
height:2.5rem;padding:0 0.75rem;
border:0;border-inline-start:1px solid var(--vibeui-buttongroup-040-border);
background:var(--vibeui-buttongroup-040-surface);
color:var(--vibeui-buttongroup-040-fg);
font-size:0.8125rem;font-weight:650;line-height:1;
transition:background-color .16s ease,color .16s ease;
}
[data-vibeui-block="buttongroup-040"] [data-part="target"]{width:2.5rem;padding:0}
[data-vibeui-block="buttongroup-040"] button:hover{background:oklch(0.965 0.005 265)}
[data-vibeui-block="buttongroup-040"] [data-part="copy"]{
background:oklch(0.97 0.02 265);color:var(--vibeui-buttongroup-040-accent);
}
[data-vibeui-block="buttongroup-040"] [data-part="copy"]:hover{background:oklch(0.94 0.035 265)}
[data-vibeui-block="buttongroup-040"] button:focus-visible{
z-index:1;outline:2px solid var(--vibeui-buttongroup-040-accent);outline-offset:-2px;
}
[data-vibeui-block="buttongroup-040"] svg{
width:1rem;height:1rem;
stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="buttongroup-040"] *{animation:none!important;transition:none!important}}
`
const ICONS: Record<string, { path: string; label: string }> = {
mail: { path: "M3 6h18v12H3zM3 7l9 6 9-6", label: "Отправить письмом" },
chat: {
path: "M4 5h16v10H8l-4 4z",
label: "Отправить сообщением",
},
qr: {
path: "M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h2v2h-2zM18 18h2v2h-2z",
label: "Показать QR-код",
},
}
/**
* Группа шеринга, где ссылка видна прямо в сцепке, а копирование — главное.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Buttongroup040({
link = "vibeui.dev/r/buttongroup-040",
copyLabel = "Копировать",
targets = ["mail", "chat", "qr"],
label = "Поделиться ссылкой",
accent,
className,
style,
...props
}: Buttongroup040Props) {
const palette = {
...(accent ? { "--vibeui-buttongroup-040-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-buttongroup-040" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="buttongroup-040"
className={className}
style={palette}
role="group"
aria-label={label}
>
<span data-part="link" title={link}>
{link}
</span>
<button type="button" data-part="copy">
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M9 9h11v11H9zM5 15H4V4h11v1" />
</svg>
{copyLabel}
</button>
{targets.map((target) => {
const icon = ICONS[target] ?? ICONS.mail
return (
<button
key={target}
type="button"
data-part="target"
aria-label={icon.label}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d={icon.path} />
</svg>
</button>
)
})}
</div>
</>
)
}