Inputs
Input Group
A field whose fixed parts — a domain, a protocol, a unit — sit inside the same border as the input. Focus lights up the whole group, not just the middle.
- input
- input group
- prefix
- form
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/input-002?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 "input-002" (Input 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/input-002.json
Registry item: https://vibeui.ru/r/input-002.json
Installs to: components/vibeui/input-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
A field whose fixed parts — a domain, a protocol, a unit — sit inside the same border as the input. Focus lights up the whole group, not just the middle.
An input with immutable parts on the left and right sharing one border: protocol and domain, a currency symbol, a unit, a file extension. Each fixed part is separated by a hairline, and :focus-within lights the whole group. Zero dependencies, one file, its own palette, no client JS.
## 3. How to use it
import { Input002 } from "@/components/vibeui/input-002"
<Input002
id="slug"
name="slug"
label="Page address"
prefix="vibeui.ru/"
placeholder="portfolio"
/>
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-input-002-* palette — do not swap it for your theme tokens (bg-muted, border-input, text-muted-foreground and the like)
- the shared border: it lives on the group and the input itself has none, otherwise a second border appears inside the first
- the :focus-within highlight together with the box-shadow ring: without it only the middle lights up on focus
- the dividers between the fixed parts and the field (border-right at the start, border-left at the end) and their tinted background — they are what marks those parts as not editable
- overflow:hidden on the group: it clips the fixed part's background to the border radius
- user-select:none on the fixed parts — they are not meant to be selected or copied along with the value
- the <style> block inside the component — it holds the palette, the geometry and the focus behaviour
## 6. You may change
- the prefix and suffix content — both are ReactNode, so your own icon fits there too
- the label and placeholder copy
- the accent through the accent prop — it colours the border and ring on focus
- any native input props: type, name, value, onChange, inputMode, required, disabled
- width and outer spacing through className — by default the group fills its parent
## 7. Rules
- Do not put buttons in prefix or suffix. Those are non-interactive parts of the border; a button next to a field needs its own component.
- Do not repeat the prefix in the placeholder — the user would read vibeui.ru twice.
- id is what links the label to the field. Without it, clicking the label does not focus the input.
- 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/input-002.jsonhttps://vibeui.ru/r/input-002.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-input-002-*. Приставка и окончание — обычные span'ы внутри рамки, поле растягивается между ними на flex. Подсветка группы держится на :focus-within, выключенное состояние — на :has(input:disabled), поэтому JS не нужен и компонент остаётся серверным. Внутри нативный <input>, принимающий любые его пропсы.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from "react"
export type Input002Props = Omit<
ComponentPropsWithoutRef<"input">,
"size" | "prefix"
> & {
/** Неизменяемая часть слева: протокол, домен, символ валюты. */
prefix?: ReactNode
/** Неизменяемая часть справа: домен почты, единица измерения, расширение. */
suffix?: ReactNode
label?: string
accent?: string
}
// Идея компонента: приставка и окончание живут внутри той же рамки, что и
// поле, а фокус подсвечивает группу целиком. Пользователь видит будущее
// значение полностью и не набирает то, что и так известно.
const STYLES = `
:where([data-vibeui-block="input-002"]){
--vibeui-input-002-surface:oklch(1 0 0);
--vibeui-input-002-surface-border:oklch(0.91 0.006 265);
--vibeui-input-002-fg:oklch(0.24 0.016 265);
--vibeui-input-002-muted:oklch(0.54 0.014 265);
--vibeui-input-002-bg:oklch(1 0 0);
--vibeui-input-002-fixed:oklch(0.97 0.003 265);
--vibeui-input-002-border:oklch(0.87 0.008 265);
--vibeui-input-002-accent:oklch(0.55 0.2 262);
--vibeui-input-002-radius:0.625rem;
--vibeui-input-002-height:2.75rem;
--vibeui-input-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Собственная подложка: подпись поля — это текст, и на тёмной странице
он обязан читаться без правки палитры проекта. */
[data-vibeui-block="input-002"]{
box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-input-002-surface);
border:1px solid var(--vibeui-input-002-surface-border);border-radius:0.875rem;
display:flex;flex-direction:column;gap:0.375rem;
font-family:var(--vibeui-input-002-font);color:var(--vibeui-input-002-fg);
}
[data-vibeui-block="input-002"] [data-part="label"]{
font-size:0.8125rem;font-weight:500;
}
[data-vibeui-block="input-002"] [data-part="group"]{
display:flex;align-items:stretch;overflow:hidden;
height:var(--vibeui-input-002-height);
border:1px solid var(--vibeui-input-002-border);
border-radius:var(--vibeui-input-002-radius);
background:var(--vibeui-input-002-bg);
transition:border-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="input-002"] [data-part="group"]:focus-within{
border-color:var(--vibeui-input-002-accent);
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-input-002-accent) 22%,transparent);
}
[data-vibeui-block="input-002"] [data-part="fixed"]{
display:flex;align-items:center;flex:none;
padding:0 0.75rem;
background:var(--vibeui-input-002-fixed);
color:var(--vibeui-input-002-muted);
font-size:0.875rem;white-space:nowrap;user-select:none;
}
[data-vibeui-block="input-002"] [data-part="fixed"][data-side="start"]{border-right:1px solid var(--vibeui-input-002-border)}
[data-vibeui-block="input-002"] [data-part="fixed"][data-side="end"]{border-left:1px solid var(--vibeui-input-002-border)}
[data-vibeui-block="input-002"] input{
flex:1 1 auto;min-width:0;margin:0;border:0;outline:none;
padding:0 0.75rem;background:transparent;color:inherit;
font:inherit;font-size:0.9375rem;
}
[data-vibeui-block="input-002"] input::placeholder{color:color-mix(in oklab,var(--vibeui-input-002-muted) 70%,transparent)}
[data-vibeui-block="input-002"] input:disabled{cursor:not-allowed}
[data-vibeui-block="input-002"]:has(input:disabled) [data-part="group"]{opacity:.55}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="input-002"] *{animation:none!important;transition:none!important}}
`
/**
* Поле с неизменяемой приставкой и окончанием в одной рамке.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Input002({
prefix = "vibeui.ru/",
suffix,
label = "Адрес страницы",
accent,
id,
className,
style,
...props
}: Input002Props) {
const palette = {
...(accent ? { "--vibeui-input-002-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-input-002" precedence="medium">
{STYLES}
</style>
<div data-vibeui-block="input-002" className={className} style={palette}>
{label ? (
<label data-part="label" htmlFor={id}>
{label}
</label>
) : null}
<div data-part="group">
{prefix ? (
<span data-part="fixed" data-side="start">
{prefix}
</span>
) : null}
<input {...props} id={id} />
{suffix ? (
<span data-part="fixed" data-side="end">
{suffix}
</span>
) : null}
</div>
</div>
</>
)
}