Button Group

Payment Methods

Payment method cards with a real, visible radio dot: at the money step the doubt "did I actually pick one" costs more than elegance.

  • buttongroup
  • payment
  • radio-cards
  • checkout

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/buttongroup-036?lang=en

Payment method
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-036" (Payment Methods) 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-036.json

Registry item: https://vibeui.ru/r/buttongroup-036.json
Installs to: components/vibeui/buttongroup-036.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
Payment method cards with a real, visible radio dot: at the money step the doubt "did I actually pick one" costs more than elegance.

Payment method cards with a visible selection dot and a hint line. Zero dependencies, one file, a server component.

## 3. How to use it
import { Buttongroup036 } from "@/components/vibeui/buttongroup-036"

<Buttongroup036
  methods={[{ id: "card", label: "Card", hint: "Visa, Mastercard" }]}
  defaultValue="card"
  label="Payment method"
  name="payment"
/>

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-036-* palette — do not swap it for your theme tokens
- the visible radio dot: at the payment step a familiar control beats minimalism
- the hint on the second line — "instant transfer" without "by QR code" lands with nobody
- wrapping cards instead of squeezing them: a squeezed card loses its hint first
- the border and box-shadow in one colour on the selected card, so the line does not look thinner
- radios inside a fieldset — the payment method must reach the form and work with arrows

## 6. You may change
- the methods and their hints through methods
- the initial method through defaultValue
- the accessible group name through label
- the form field name through name and the selection colour through accent

## 7. Rules
- The 11rem column minimum is hard-coded in auto-fit: retune it for longer names.
- The component charges nothing: your code handles the choice after submit.
- Payment brand logos are not bundled — add them with your own markup in the hint.
- 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-036.json
https://vibeui.ru/r/buttongroup-036.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в переменных --vibeui-buttongroup-036-*. Серверный: выбор держат radio внутри fieldset. В отличие от сегментированных групп, кружок выбора здесь не прячется, а рисуется: сам input лежит поверх карточки прозрачным слоем, а видимый кружок — span с inset box-shadow вместо внутренней точки. Карточки разложены grid с repeat(auto-fit,minmax(11rem,1fr)): на узкой ширине они переносятся, а не сжимаются до нечитаемого. Выбранная карточка получает и рамку, и box-shadow того же цвета, чтобы линия не выглядела тоньше соседних. Второй строкой у каждого способа стоит короткое пояснение.

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 Buttongroup036Method = {
  id: string
  label: string
  hint: string
}

export type Buttongroup036Props = Omit<
  ComponentPropsWithoutRef<"fieldset">,
  "children"
> & {
  methods?: Buttongroup036Method[]
  defaultValue?: string
  label?: string
  name?: string
  accent?: string
}

// Идея компонента: способ оплаты — решение о деньгах, поэтому кружок radio
// здесь не прячется, а рисуется. Пользователь должен видеть привычный
// элемент выбора, а не догадываться о нём по заливке: сомнение «выбрал ли я»
// на этом шаге стоит дороже красоты. Сам input лежит поверх карточки
// прозрачным слоем, а видимый кружок собран из span с внутренней точкой на
// box-shadow. Карточки — grid с auto-fit: на узкой ширине они переносятся,
// а не сжимаются до нечитаемого.
const STYLES = `
:where([data-vibeui-block="buttongroup-036"]){
--vibeui-buttongroup-036-surface:oklch(1 0 0);
--vibeui-buttongroup-036-fg:oklch(0.24 0.016 265);
--vibeui-buttongroup-036-muted:oklch(0.56 0.014 265);
--vibeui-buttongroup-036-border:oklch(0.89 0.008 265);
--vibeui-buttongroup-036-on:oklch(0.975 0.02 155);
--vibeui-buttongroup-036-accent:oklch(0.48 0.13 155);
--vibeui-buttongroup-036-radius:0.75rem;
--vibeui-buttongroup-036-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="buttongroup-036"]{
box-sizing:border-box;display:block;width:100%;max-width:28rem;
margin:0;padding:0;border:0;
font-family:var(--vibeui-buttongroup-036-font);
}
[data-vibeui-block="buttongroup-036"] *{box-sizing:border-box}
[data-vibeui-block="buttongroup-036"] legend{
padding:0;margin:0 0 0.5rem;float:left;width:100%;clear:both;
color:var(--vibeui-buttongroup-036-fg);
font-size:0.8125rem;font-weight:650;line-height:1.35;
}
[data-vibeui-block="buttongroup-036"] [data-part="track"]{
display:grid;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));gap:0.5rem;clear:both;
}
[data-vibeui-block="buttongroup-036"] [data-part="card"]{
position:relative;
display:flex;align-items:center;gap:0.5625rem;
padding:0.625rem 0.75rem;
border:1px solid var(--vibeui-buttongroup-036-border);
border-radius:var(--vibeui-buttongroup-036-radius);
background:var(--vibeui-buttongroup-036-surface);
cursor:pointer;
transition:border-color .16s ease,background-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="buttongroup-036"] input{
position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;
}
/* Видимый кружок выбора: на этом шаге он важнее заливки. */
[data-vibeui-block="buttongroup-036"] [data-part="dot"]{
flex:none;width:1.125rem;height:1.125rem;border-radius:9999px;
border:1.5px solid oklch(0.78 0.01 265);
background:var(--vibeui-buttongroup-036-surface);
transition:border-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="buttongroup-036"] [data-part="text"]{
display:flex;flex-direction:column;gap:0.0625rem;min-width:0;
}
[data-vibeui-block="buttongroup-036"] [data-part="name"]{
color:var(--vibeui-buttongroup-036-fg);
font-size:0.8125rem;font-weight:650;line-height:1.25;
}
[data-vibeui-block="buttongroup-036"] [data-part="hint"]{
color:var(--vibeui-buttongroup-036-muted);
font-size:0.6875rem;line-height:1.3;
}
[data-vibeui-block="buttongroup-036"] [data-part="card"]:hover{border-color:oklch(0.78 0.01 265)}
[data-vibeui-block="buttongroup-036"] [data-part="card"]:has(input:checked){
background:var(--vibeui-buttongroup-036-on);
border-color:var(--vibeui-buttongroup-036-accent);
box-shadow:0 0 0 1px var(--vibeui-buttongroup-036-accent);
}
[data-vibeui-block="buttongroup-036"] [data-part="card"]:has(input:checked) [data-part="dot"]{
border-color:var(--vibeui-buttongroup-036-accent);
box-shadow:inset 0 0 0 4px var(--vibeui-buttongroup-036-accent);
}
[data-vibeui-block="buttongroup-036"] [data-part="card"]:has(input:focus-visible){
outline:2px solid var(--vibeui-buttongroup-036-accent);outline-offset:2px;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="buttongroup-036"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_METHODS: Buttongroup036Method[] = [
  { id: "card", label: "Картой", hint: "Visa, Mastercard, МИР" },
  { id: "sbp", label: "Через СБП", hint: "по QR-коду, без комиссии" },
  { id: "invoice", label: "По счёту", hint: "для юридических лиц" },
  { id: "later", label: "Частями", hint: "4 платежа раз в две недели" },
]

/**
 * Выбор способа оплаты карточками с настоящим видимым кружком radio.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Buttongroup036({
  methods = DEFAULT_METHODS,
  defaultValue = "sbp",
  label = "Способ оплаты",
  name = "buttongroup-036",
  accent,
  className,
  style,
  ...props
}: Buttongroup036Props) {
  const palette = {
    ...(accent ? { "--vibeui-buttongroup-036-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-buttongroup-036" precedence="medium">
        {STYLES}
      </style>
      <fieldset
        {...props}
        data-vibeui-block="buttongroup-036"
        className={className}
        style={palette}
      >
        <legend>{label}</legend>
        <div data-part="track">
          {methods.map((method) => (
            <label key={method.id} data-part="card">
              <input
                type="radio"
                name={name}
                value={method.id}
                defaultChecked={method.id === defaultValue}
              />
              <span data-part="dot" aria-hidden="true" />
              <span data-part="text">
                <span data-part="name">{method.label}</span>
                <span data-part="hint">{method.hint}</span>
              </span>
            </label>
          ))}
        </div>
      </fieldset>
    </>
  )
}