Inputs
Inline Label Row
A form row with the label on the left: at wide widths the label column aligns the whole form on one vertical, and narrow it folds into a column.
- field
- layout
- form
- responsive
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/field-009?lang=en
This is how you appear in comments and history.
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-009" (Inline Label Row) 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-009.json
Registry item: https://vibeui.ru/r/field-009.json
Installs to: components/vibeui/field-009.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 row with the label on the left: at wide widths the label column aligns the whole form on one vertical, and narrow it folds into a column.
A form of label-left, field-right rows. From 30rem of the block's own width the labels form a column and the fields share one vertical; below that each row folds. The width is measured on the block, not the viewport. A server component, zero dependencies, one file, its own palette.
## 3. How to use it
import { Field009 } from "@/components/vibeui/field-009"
<Field009
name="profile"
label="Display name"
labelWidth="10rem"
/>
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-009-* palette — do not swap it for your theme tokens (bg-background, border-input and the like)
- container-type:inline-size on the root and the @container rules on the inner [data-part="shell"]: a container query does not apply to its own container, and a rule targeting the root inside it silently does nothing
- the fold to a column at narrow widths: a label-left row leaves the field a third of a phone screen
- the fixed label column width through the variable — without it the fields stop sharing one vertical
- the right-aligned labels in the wide layout: that keeps the gap to the field equal on every row
- the htmlFor/id link between label and control — people click the label to reach the field
- the <style> block inside the component — it holds the palette and both layouts
## 6. You may change
- the label and hint copy
- labelWidth — the width of the label column in the wide layout
- the @container threshold at which the row stops folding
- the accent through the accent prop
- the name prop: every field id is built from it
## 7. Rules
- The threshold is in rem of the block's own width, not the window: a narrow desktop column gets the mobile layout, and that is correct.
- Keep labels to one line: long text in the label column wraps and breaks the shared vertical.
- Put the hint under the field, not under the label — otherwise it slides into the label column and gets lost.
- 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-009.jsonhttps://vibeui.ru/r/field-009.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-field-009-*. Серверный: состояния нет. Раскладка считается container query по собственной ширине блока, поэтому форма в боковой панели ведёт себя как узкая даже на десктопе. Правило @container целит во внутренний [data-part="shell"] и его строки, а не в сам контейнер: контейнерный запрос не действует на элемент, который его объявил. Ширина колонки подписей задаётся переменной --vibeui-field-009-label.
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 Field009Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "defaultValue"
> & {
label?: string
hint?: string
labelWidth?: string
name?: string
accent?: string
}
// Идея компонента: строка формы с подписью слева. На широком экране колонка
// подписей выравнивает всю форму по одной вертикали и глаз находит нужное
// поле за один проход. На узком та же строка складывается в столбец. Ширина
// считается по собственной ширине блока через container query, а не по
// вьюпорту, — форма в боковой панели ведёт себя как узкая, даже на десктопе.
const STYLES = `
:where([data-vibeui-block="field-009"]){
--vibeui-field-009-bg:oklch(1 0 0);
--vibeui-field-009-surface:oklch(1 0 0);
--vibeui-field-009-fg:oklch(0.24 0.014 265);
--vibeui-field-009-muted:oklch(0.55 0.014 265);
--vibeui-field-009-border:oklch(0.88 0.008 265);
--vibeui-field-009-shell:oklch(0.91 0.006 265);
--vibeui-field-009-accent:oklch(0.55 0.2 262);
--vibeui-field-009-label:9rem;
--vibeui-field-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
/* Своя светлая подложка: строку показывают поверх любого фона. */
[data-vibeui-block="field-009"]{
display:block;width:100%;max-width:34rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-field-009-surface);
border:1px solid var(--vibeui-field-009-shell);border-radius:0.875rem;
font-family:var(--vibeui-field-009-font);color:var(--vibeui-field-009-fg);
}
[data-vibeui-block="field-009"] *{box-sizing:border-box}
/* Раскладка живёт на shell: правило @container не действует на сам контейнер. */
[data-vibeui-block="field-009"] [data-part="shell"]{
display:flex;flex-direction:column;gap:0.75rem;
}
[data-vibeui-block="field-009"] [data-part="row"]{
display:flex;flex-direction:column;gap:0.3125rem;
}
[data-vibeui-block="field-009"] label{
font-size:0.8125rem;font-weight:600;line-height:1.35;
}
[data-vibeui-block="field-009"] [data-part="control"]{display:flex;flex-direction:column;gap:0.25rem;min-width:0}
[data-vibeui-block="field-009"] :is(input,select){
width:100%;height:2.375rem;padding:0 0.75rem;
background:var(--vibeui-field-009-bg);color:inherit;
border:1px solid var(--vibeui-field-009-border);border-radius:0.625rem;
font:inherit;font-size:0.875rem;
}
[data-vibeui-block="field-009"] :is(input,select):focus-visible{
outline:2px solid var(--vibeui-field-009-accent);outline-offset:1px;
border-color:var(--vibeui-field-009-accent);
}
[data-vibeui-block="field-009"] input::placeholder{color:var(--vibeui-field-009-muted)}
[data-vibeui-block="field-009"] [data-part="hint"]{
margin:0;font-size:0.75rem;line-height:1.4;color:var(--vibeui-field-009-muted);
}
/* От 30rem собственной ширины — колонка подписей и общая вертикаль полей. */
@container (min-width: 30rem){
[data-vibeui-block="field-009"] [data-part="row"]{
flex-direction:row;align-items:baseline;gap:1rem;
}
[data-vibeui-block="field-009"] [data-part="row"] > label{
flex:none;width:var(--vibeui-field-009-label);
text-align:end;color:var(--vibeui-field-009-muted);
}
[data-vibeui-block="field-009"] [data-part="control"]{flex:1}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="field-009"] *{animation:none!important;transition:none!important}}
`
/**
* Строка формы с подписью слева, складывающаяся в столбец на узкой ширине.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Field009({
label = "Отображаемое имя",
hint = "Так вас увидят в комментариях и в истории изменений.",
labelWidth = "9rem",
name = "profile",
accent,
className,
style,
...props
}: Field009Props) {
const palette = {
"--vibeui-field-009-label": labelWidth,
...(accent ? { "--vibeui-field-009-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-field-009" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="field-009"
className={className}
style={palette}
>
<div data-part="shell">
<div data-part="row">
<label htmlFor={`${name}-name`}>{label}</label>
<div data-part="control">
<input
id={`${name}-name`}
name={`${name}-name`}
type="text"
defaultValue="Анна Кузнецова"
aria-describedby={`${name}-hint`}
/>
<p id={`${name}-hint`} data-part="hint">
{hint}
</p>
</div>
</div>
<div data-part="row">
<label htmlFor={`${name}-role`}>Роль в команде</label>
<div data-part="control">
<select id={`${name}-role`} name={`${name}-role`}>
<option>Владелец</option>
<option>Редактор</option>
<option>Наблюдатель</option>
</select>
</div>
</div>
<div data-part="row">
<label htmlFor={`${name}-city`}>Город</label>
<div data-part="control">
<input
id={`${name}-city`}
name={`${name}-city`}
type="text"
placeholder="Например, Казань"
/>
</div>
</div>
</div>
</div>
</>
)
}