Button Group
Form Footer Bar
A form footer bar for phones: two buttons split the width evenly through flex:1 1 0, with extra bottom padding reserved for the home indicator.
- buttongroup
- mobile
- form
- full-width
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-012?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-012" (Form Footer Bar) 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-012.json
Registry item: https://vibeui.ru/r/buttongroup-012.json
Installs to: components/vibeui/buttongroup-012.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 form footer bar for phones: two buttons split the width evenly through flex:1 1 0, with extra bottom padding reserved for the home indicator.
A full-width form footer: two equal-share buttons, a safe bottom inset and a note above them. Zero dependencies, one file, a server component.
## 3. How to use it
import { Buttongroup012 } from "@/components/vibeui/buttongroup-012"
<Buttongroup012
primary="Save"
secondary="Cancel"
note="The draft is saved automatically"
label="Form footer"
/>
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-012-* palette — do not swap it for your theme tokens
- flex:1 1 0 with a zero basis: with flex:1 1 auto a long caption claims more than half the bar
- min-width:0 on the buttons — without it a flex item never shrinks below its content and the bar overflows
- env(safe-area-inset-bottom) in the bottom padding, or the primary button hides under the home indicator
- the equal button widths: priority is carried by colour and order, not by size
- the 2.75rem height — that is the minimum comfortable touch target
## 6. You may change
- the primary action caption through primary
- the cancel caption through secondary
- the note above the buttons through note and the group name through label
- the primary button colour through accent
## 7. Rules
- The buttons have no onClick and no type="submit": inside a real form change the primary button's type.
- Captions are truncated with an ellipsis: a long translation disappears quietly, check the narrowest screen.
- The bar is not sticky by default: add position:sticky on the page side, not inside the component.
- 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-012.jsonhttps://vibeui.ru/r/buttongroup-012.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в переменных --vibeui-buttongroup-012-*. Серверный: хуков нет. Равные доли держит flex:1 1 0 — именно ноль в основе, иначе длинная подпись раздувает свою долю; min-width:0 разрешает кнопке сжиматься меньше содержимого, а лишний текст обрезается ellipsis. Нижний отступ считается как calc(0.75rem + env(safe-area-inset-bottom,0px)), чтобы главная кнопка не оказалась под жестом системы. Приоритет несут цвет и порядок, а не ширина: главная кнопка не шире второстепенной. Раскладка от собственной ширины: width:100% с max-width:26rem.
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 Buttongroup012Props = Omit<
ComponentPropsWithoutRef<"div">,
"children"
> & {
primary?: string
secondary?: string
note?: string
label?: string
accent?: string
}
// Идея компонента: нижняя панель формы на телефоне. Кнопки делят ширину
// поровну через flex:1 1 0 — именно ноль в основе, иначе длинная подпись
// раздувает свою долю и панель перестаёт быть симметричной. min-width:0
// разрешает подписи ужиматься: без него flex-элемент не сжимается меньше
// своего содержимого и панель выезжает за экран. Снизу добавлен отступ на
// домашнюю полоску, чтобы главная кнопка не оказалась под жестом системы.
const STYLES = `
:where([data-vibeui-block="buttongroup-012"]){
--vibeui-buttongroup-012-surface:oklch(1 0 0);
--vibeui-buttongroup-012-fg:oklch(0.26 0.016 265);
--vibeui-buttongroup-012-muted:oklch(0.55 0.014 265);
--vibeui-buttongroup-012-border:oklch(0.89 0.008 265);
--vibeui-buttongroup-012-hover:oklch(0.96 0.004 265);
--vibeui-buttongroup-012-accent:oklch(0.52 0.17 265);
--vibeui-buttongroup-012-accent-dark:oklch(0.45 0.16 265);
--vibeui-buttongroup-012-on-accent:oklch(0.99 0.005 265);
--vibeui-buttongroup-012-radius:0.75rem;
--vibeui-buttongroup-012-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="buttongroup-012"]{
box-sizing:border-box;width:100%;max-width:26rem;
padding:0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom,0px));
border:1px solid var(--vibeui-buttongroup-012-border);
border-radius:1rem;
background:var(--vibeui-buttongroup-012-surface);
font-family:var(--vibeui-buttongroup-012-font);
box-shadow:0 -6px 20px -18px oklch(0.2 0.02 265 / 70%);
}
[data-vibeui-block="buttongroup-012"] *{box-sizing:border-box}
[data-vibeui-block="buttongroup-012"] [data-part="row"]{display:flex;gap:0.5rem}
[data-vibeui-block="buttongroup-012"] button{
appearance:none;cursor:pointer;font:inherit;
flex:1 1 0;min-width:0;
display:inline-flex;align-items:center;justify-content:center;
height:2.75rem;padding:0 0.75rem;
border:1px solid var(--vibeui-buttongroup-012-border);
border-radius:var(--vibeui-buttongroup-012-radius);
background:var(--vibeui-buttongroup-012-surface);
color:var(--vibeui-buttongroup-012-fg);
font-size:0.9375rem;font-weight:650;line-height:1;
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
transition:background-color .16s ease,border-color .16s ease;
}
[data-vibeui-block="buttongroup-012"] button:hover{background:var(--vibeui-buttongroup-012-hover)}
[data-vibeui-block="buttongroup-012"] button:focus-visible{
outline:2px solid var(--vibeui-buttongroup-012-accent);outline-offset:2px;
}
/* Главная кнопка не шире второстепенной: приоритет несут цвет и порядок,
а не размер — иначе панель перестаёт быть равнодолевой. */
[data-vibeui-block="buttongroup-012"] [data-part="primary"]{
background:var(--vibeui-buttongroup-012-accent);
border-color:var(--vibeui-buttongroup-012-accent);
color:var(--vibeui-buttongroup-012-on-accent);
}
[data-vibeui-block="buttongroup-012"] [data-part="primary"]:hover{
background:var(--vibeui-buttongroup-012-accent-dark);
border-color:var(--vibeui-buttongroup-012-accent-dark);
}
[data-vibeui-block="buttongroup-012"] [data-part="note"]{
margin:0 0 0.5rem;text-align:center;
color:var(--vibeui-buttongroup-012-muted);
font-size:0.75rem;line-height:1.4;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="buttongroup-012"] *{animation:none!important;transition:none!important}}
`
/**
* Нижняя панель формы: две кнопки во всю ширину равными долями.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Buttongroup012({
primary = "Сохранить",
secondary = "Отмена",
note = "Черновик сохраняется автоматически",
label = "Завершение формы",
accent,
className,
style,
...props
}: Buttongroup012Props) {
const palette = {
...(accent ? { "--vibeui-buttongroup-012-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-buttongroup-012" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="buttongroup-012"
className={className}
style={palette}
>
{note ? <p data-part="note">{note}</p> : null}
<div data-part="row" role="group" aria-label={label}>
<button type="button">{secondary}</button>
<button type="button" data-part="primary">
{primary}
</button>
</div>
</div>
</>
)
}