Inputs

Plain Radio Group

The plainest radio group: a question and its options with no cards or frames, and the dot inside the circle drawn by an inset shadow rather than a separate node.

  • radio
  • group
  • form
  • minimal

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/radio-002?lang=en

How should we reach you
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 "radio-002" (Plain Radio Group) 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/radio-002.json

Registry item: https://vibeui.ru/r/radio-002.json
Installs to: components/vibeui/radio-002.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
The plainest radio group: a question and its options with no cards or frames, and the dot inside the circle drawn by an inset shadow rather than a separate node.

A minimal radio group with the mark drawn by an inset shadow. One file, zero dependencies, a server component with no client JS.

## 3. How to use it
import { Radio002 } from "@/components/vibeui/radio-002"

<Radio002
  legend="How should we reach you"
  defaultValue="Email"
/>

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-radio-002-* palette — do not swap it for your theme tokens
- the fieldset with a legend: without them the options are not announced as answers to one question
- the shared name on every input — without it the radios stop being a group and are picked independently
- the dot made of an inset shadow: a separate node drifts when the font size changes
- float:left on the legend together with clear:both on the list — otherwise the rows wrap around the legend
- the component's own light surface — without it the dark text disappears on a dark page

## 6. You may change
- the question through legend
- the choices through options
- the preselected answer through defaultValue
- the form field name through name

## 7. Rules
- The mark's shadow depends on the background colour: on a tinted surface the circle has to be repainted with it.
- For long wording lift the circle to the first line — right now it is centred on a single-line option.
- Beyond five options a list with descriptions works better: bare captions stop helping.
- 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/radio-002.json
https://vibeui.ru/r/radio-002.json

Серверный компонент на fieldset с legend: скринридер объявляет вопрос перед вариантами. Кружок собран из appearance:none и рамки, отметка — две внутренние тени, наложенные друг на друга, поэтому лишнего span не нужно и точка не съезжает при изменении размера шрифта. Легенда прижата float:left, список получает clear:both. Палитра в --vibeui-radio-002-*, зависимостей нет.

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 Radio002Props = Omit<
  ComponentPropsWithoutRef<"fieldset">,
  "children" | "defaultValue"
> & {
  legend?: string
  options?: string[]
  name?: string
  defaultValue?: string
  accent?: string
}

// Идея компонента: самая простая радиогруппа — только вопрос и варианты,
// без карточек и рамок. Кружок собран из appearance:none и внутренней тени:
// точка внутри не отдельный узел, поэтому она не сдвигается при масштабе
// шрифта и наследует цвет акцента одной переменной.
const STYLES = `
:where([data-vibeui-block="radio-002"]){
--vibeui-radio-002-bg:oklch(1 0 0);
--vibeui-radio-002-fg:oklch(0.23 0.014 265);
--vibeui-radio-002-muted:oklch(0.56 0.014 265);
--vibeui-radio-002-border:oklch(0.9 0.006 265);
--vibeui-radio-002-ring:oklch(0.72 0.012 265);
--vibeui-radio-002-accent:oklch(0.55 0.19 262);
--vibeui-radio-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="radio-002"]{
display:flex;flex-direction:column;
width:100%;max-width:18rem;box-sizing:border-box;
margin:0;padding:0.5rem 0.875rem 0.875rem;
background:var(--vibeui-radio-002-bg);
border:1px solid var(--vibeui-radio-002-border);border-radius:0.875rem;
font-family:var(--vibeui-radio-002-font);color:var(--vibeui-radio-002-fg);
}
/* float + clear: легенда fieldset иначе садится на рамку, а следующие
   flex-дети начинают её обтекать. */
[data-vibeui-block="radio-002"] legend{
float:left;width:100%;padding:0;margin:0.375rem 0 0.625rem;
font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="radio-002"] [data-part="list"]{clear:both;display:flex;flex-direction:column;gap:0.625rem}
[data-vibeui-block="radio-002"] [data-part="option"]{
display:flex;align-items:center;gap:0.625rem;cursor:pointer;
font-size:0.875rem;line-height:1.35;
}
[data-vibeui-block="radio-002"] input{
appearance:none;-webkit-appearance:none;flex:none;margin:0;cursor:pointer;
width:1.125rem;height:1.125rem;border-radius:9999px;
border:1.5px solid var(--vibeui-radio-002-ring);
background:var(--vibeui-radio-002-bg);
transition:border-color .16s ease,box-shadow .16s ease;
}
/* Точка — внутренняя тень, а не отдельный узел: не съезжает при
   изменении размера шрифта и не требует лишнего span. */
[data-vibeui-block="radio-002"] input:checked{
border-color:var(--vibeui-radio-002-accent);
box-shadow:inset 0 0 0 0.25rem var(--vibeui-radio-002-bg),inset 0 0 0 1rem var(--vibeui-radio-002-accent);
}
[data-vibeui-block="radio-002"] input:hover:not(:checked){border-color:var(--vibeui-radio-002-muted)}
[data-vibeui-block="radio-002"] input:focus-visible{outline:2px solid var(--vibeui-radio-002-accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="radio-002"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_OPTIONS = [
  "Электронная почта",
  "Телефонный звонок",
  "Сообщение в мессенджер",
]

/**
 * Простая радиогруппа: вопрос и варианты, точка нарисована внутренней тенью.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Radio002({
  legend = "Как с вами связаться",
  options = DEFAULT_OPTIONS,
  name = "vibeui-radio-002",
  defaultValue = "Телефонный звонок",
  accent,
  className,
  style,
  ...props
}: Radio002Props) {
  const palette = {
    ...(accent ? { "--vibeui-radio-002-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-radio-002" precedence="medium">
        {STYLES}
      </style>
      <fieldset
        {...props}
        data-vibeui-block="radio-002"
        className={className}
        style={palette}
      >
        <legend>{legend}</legend>
        <div data-part="list">
          {options.map((option) => (
            <label key={option} data-part="option">
              <input
                type="radio"
                name={name}
                value={option}
                defaultChecked={option === defaultValue}
              />
              <span>{option}</span>
            </label>
          ))}
        </div>
      </fieldset>
    </>
  )
}