Inputs

Required Marker

A required field whose asterisk explains itself: an <abbr> expansion, a hidden word for screen readers and a footnote sitting right beside the fields.

  • field
  • required
  • form
  • a11y

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/field-003?lang=en

Starred fields are required to submit.

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 "field-003" (Required Marker) 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/field-003.json

Registry item: https://vibeui.ru/r/field-003.json
Installs to: components/vibeui/field-003.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 required field whose asterisk explains itself: an <abbr> expansion, a hidden word for screen readers and a footnote sitting right beside the fields.

A pair of fields — one required, one optional — with a footnote that explains the asterisk. The symbol is wrapped in an <abbr> and doubled by hidden text, so it lands both by eye and by ear. A server component, zero dependencies, one file, its own palette.

## 3. How to use it
import { Field003 } from "@/components/vibeui/field-003"

<Field003
  name="company"
  label="Registered name"
  legend="Fields marked with an asterisk are needed to accept the application."
/>

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-field-003-* palette — do not swap it for your theme tokens (bg-background, border-input and the like)
- the three-way explanation of the asterisk: <abbr title> for the mouse, hidden text for screen readers and the footnote for first-time readers
- aria-hidden on the glyph itself paired with the visually hidden duplicate — otherwise it is announced literally as "asterisk"
- the pair of fields: required next to optional — one field alone shows no contrast
- the explicit "optional" marker instead of nothing: the absence of an asterisk is not a signal
- the coloured bar on the required field as a second, non-colour cue — red is not visible to everyone
- the <style> block inside the component — it holds the palette and the footnote styling

## 6. You may change
- the label and optionalLabel copy, and the legend footnote text
- the name prop: both field ids are built from it
- the accent through the accent prop — it colours focus
- the set of fields inside: the pair is a sample, there can be more
- width and outer spacing through className

## 7. Rules
- If nearly everything is required, mark the optional fields instead: an asterisk on every row stops meaning anything.
- The footnote belongs beside the fields. At the end of a long form nobody reads it, and under the first error it is too late.
- The required attribute is a browser hint, not validation: the server confirms what is mandatory.
- 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/field-003.json
https://vibeui.ru/r/field-003.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-field-003-*. Серверный: состояния нет. Звёздочка обёрнута в <abbr title>, продублирована визуально скрытым текстом и объяснена сноской под парой полей. Рядом стоит необязательное поле с явной меткой — пара показывает разницу, а не намекает на неё. У обязательного поля выставлены required и aria-required.

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 Field003Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "defaultValue"
> & {
  label?: string
  optionalLabel?: string
  legend?: string
  name?: string
  accent?: string
}

// Идея компонента: звёздочка, которая объясняет себя. Символ «*» ничего не
// значит для того, кто видит форму впервые, и совсем ничего — для screen
// reader. Здесь он обёрнут в <abbr> с расшифровкой, продублирован скрытым
// словом «обязательно» и объяснён сноской под парой полей. Рядом стоит
// необязательное поле с явной меткой: пара показывает разницу, а не намекает.
const STYLES = `
:where([data-vibeui-block="field-003"]){
--vibeui-field-003-bg:oklch(1 0 0);
--vibeui-field-003-surface:oklch(1 0 0);
--vibeui-field-003-fg:oklch(0.24 0.014 265);
--vibeui-field-003-muted:oklch(0.55 0.014 265);
--vibeui-field-003-border:oklch(0.88 0.008 265);
--vibeui-field-003-shell:oklch(0.91 0.006 265);
--vibeui-field-003-accent:oklch(0.55 0.2 262);
--vibeui-field-003-danger:oklch(0.55 0.19 25);
--vibeui-field-003-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: форму показывают поверх любого фона. */
[data-vibeui-block="field-003"]{
display:flex;flex-direction:column;gap:0.75rem;
width:100%;max-width:21rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-field-003-surface);
border:1px solid var(--vibeui-field-003-shell);border-radius:0.875rem;
font-family:var(--vibeui-field-003-font);color:var(--vibeui-field-003-fg);
}
[data-vibeui-block="field-003"] *{box-sizing:border-box}
[data-vibeui-block="field-003"] [data-part="row"]{display:flex;flex-direction:column;gap:0.3125rem}
[data-vibeui-block="field-003"] label{
display:flex;align-items:baseline;gap:0.25rem;
font-size:0.8125rem;font-weight:600;
}
/* Звёздочка с расшифровкой: <abbr> объясняет символ и наведением, и вслух. */
[data-vibeui-block="field-003"] abbr{
color:var(--vibeui-field-003-danger);text-decoration:none;
font-weight:700;cursor:help;
}
[data-vibeui-block="field-003"] [data-part="optional"]{
font-size:0.75rem;font-weight:500;color:var(--vibeui-field-003-muted);
}
[data-vibeui-block="field-003"] input{
width:100%;height:2.375rem;padding:0 0.75rem;
background:var(--vibeui-field-003-bg);color:inherit;
border:1px solid var(--vibeui-field-003-border);border-radius:0.625rem;
font:inherit;font-size:0.875rem;
}
[data-vibeui-block="field-003"] input::placeholder{color:var(--vibeui-field-003-muted)}
[data-vibeui-block="field-003"] input:focus-visible{
outline:2px solid var(--vibeui-field-003-accent);outline-offset:1px;
border-color:var(--vibeui-field-003-accent);
}
[data-vibeui-block="field-003"] input[required]{
border-inline-start:3px solid color-mix(in oklab,var(--vibeui-field-003-danger) 45%,oklch(1 0 0));
}
/* Сноска рядом с полями, а не в конце длинной формы: там её не читают. */
[data-vibeui-block="field-003"] [data-part="legend"]{
display:flex;align-items:flex-start;gap:0.375rem;margin:0;
padding-top:0.5rem;border-top:1px dashed var(--vibeui-field-003-border);
font-size:0.75rem;line-height:1.4;color:var(--vibeui-field-003-muted);
}
[data-vibeui-block="field-003"] [data-part="legend"] span{color:var(--vibeui-field-003-danger);font-weight:700}
[data-vibeui-block="field-003"] [data-part="sr"]{
position:absolute;width:1px;height:1px;padding:0;margin:-1px;
overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="field-003"] *{animation:none!important;transition:none!important}}
`

/**
 * Обязательное поле со звёздочкой, у которой есть расшифровка и сноска.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Field003({
  label = "Юридическое название",
  optionalLabel = "необязательно",
  legend = "Звёздочкой отмечены поля, без которых заявку не примут.",
  name = "company",
  accent,
  className,
  style,
  ...props
}: Field003Props) {
  const palette = {
    ...(accent ? { "--vibeui-field-003-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-field-003" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="field-003"
        className={className}
        style={palette}
      >
        <div data-part="row">
          <label htmlFor={`${name}-required`}>
            {label}
            <abbr title="обязательное поле" aria-hidden="true">
              *
            </abbr>
            <span data-part="sr">, обязательное поле</span>
          </label>
          <input
            id={`${name}-required`}
            name={name}
            type="text"
            required
            aria-required="true"
            placeholder="ООО «Ромашка»"
          />
        </div>

        <div data-part="row">
          <label htmlFor={`${name}-optional`}>
            Комментарий
            <span data-part="optional">· {optionalLabel}</span>
          </label>
          <input
            id={`${name}-optional`}
            name={`${name}-comment`}
            type="text"
            placeholder="Что важно знать заранее"
          />
        </div>

        <p data-part="legend">
          <span aria-hidden="true">*</span>
          {legend}
        </p>
      </div>
    </>
  )
}