Inputs

Domain Prefix

A domain prefix on the left and the page address on the right: the prefix cannot be deleted, and the address is cleaned up as you type.

  • inputgroup
  • slug
  • prefix
  • url

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/inputgroup-010?lang=en

vibeui.ru/moya-komanda12/32

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 "inputgroup-010" (Domain Prefix) 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/inputgroup-010.json

Registry item: https://vibeui.ru/r/inputgroup-010.json
Installs to: components/vibeui/inputgroup-010.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 domain prefix on the left and the page address on the right: the prefix cannot be deleted, and the address is cleaned up as you type.

A domain-prefix and slug group: the prefix is non-interactive and never submitted, the value is normalised live, and the final address is shown below. Zero dependencies, one file.

## 3. How to use it
import { Inputgroup010 } from "@/components/vibeui/inputgroup-010"

<Inputgroup010
  label="Page address"
  prefix="vibeui.ru/"
  onChange={(slug) => setSlug(slug)}
/>

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-inputgroup-010-* palette — do not swap it for your theme tokens
- the collapsed borders: neighbours carry a negative margin so the halves share one line instead of two
- raising the focused element with z-index — without it the neighbour's border clips half the ring
- the prefix outside the value: only the slug is submitted, the server adds the domain
- user-select:none and aria-hidden on the prefix: it is not selected and not read apart from the label
- normalising the value itself rather than on submit: people must see exactly what will be saved

## 6. You may change
- the label copy and the prefix text
- the normalisation rule — transliteration, for instance
- the length limit and the counter wording
- the accent through the accent prop

## 7. Rules
- Uniqueness is a server question: normalisation knows nothing about it.
- Do not put a button in prefix: it is a non-interactive part of the border.
- Non-Latin letters are simply dropped here — add transliteration to slugify if you need them.
- 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/inputgroup-010.json
https://vibeui.ru/r/inputgroup-010.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-inputgroup-010-*. Клиентский: "use client" ради нормализации. Приставка — неинтерактивный span с user-select:none и aria-hidden, она сжимается многоточием и в форму не уходит. Значение чистится на каждый ввод: нижний регистр, пробелы и подчёркивания в дефис, лишние символы отбрасываются, повторные дефисы схлопываются, длина ограничена. Под сцепкой показан итоговый адрес и счётчик длины.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

"use client"

import { useId, useState } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Inputgroup010Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "prefix" | "onChange"
> & {
  label?: string
  prefix?: string
  onChange?: (slug: string) => void
  accent?: string
}

// Идея компонента: приставка домена — часть будущего адреса, но не часть
// значения. Она лежит в сцепке слева, её нельзя выделить и нельзя стереть,
// а в форму уходит только сам slug. Ввод чистится на лету: верхний регистр,
// пробелы и запрещённые символы превращаются в дефис прямо под курсором —
// иначе человек видит одно, а сохраняется другое. Приставка сжимается
// многоточием: длинный домен не должен съедать место у самого адреса.
const STYLES = `
:where([data-vibeui-block="inputgroup-010"]){
--vibeui-inputgroup-010-surface:oklch(1 0 0);
--vibeui-inputgroup-010-shell:oklch(0.91 0.006 265);
--vibeui-inputgroup-010-fg:oklch(0.23 0.014 265);
--vibeui-inputgroup-010-muted:oklch(0.56 0.014 265);
--vibeui-inputgroup-010-field:oklch(0.99 0.002 265);
--vibeui-inputgroup-010-fixed:oklch(0.955 0.004 265);
--vibeui-inputgroup-010-border:oklch(0.86 0.008 265);
--vibeui-inputgroup-010-accent:oklch(0.5 0.15 175);
--vibeui-inputgroup-010-radius:0.75rem;
--vibeui-inputgroup-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
--vibeui-inputgroup-010-mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
}
[data-vibeui-block="inputgroup-010"]{
display:flex;flex-direction:column;gap:0.4375rem;
width:100%;max-width:23rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-inputgroup-010-surface);
border:1px solid var(--vibeui-inputgroup-010-shell);border-radius:0.875rem;
font-family:var(--vibeui-inputgroup-010-font);color:var(--vibeui-inputgroup-010-fg);
}
[data-vibeui-block="inputgroup-010"] *{box-sizing:border-box}
[data-vibeui-block="inputgroup-010"] label{font-size:0.8125rem;font-weight:600}
[data-vibeui-block="inputgroup-010"] [data-part="group"]{display:flex;align-items:stretch;min-width:0}
[data-vibeui-block="inputgroup-010"] [data-part="group"] > *{
position:relative;height:2.75rem;
border:1px solid var(--vibeui-inputgroup-010-border);
border-radius:0;margin-left:-1px;font:inherit;color:inherit;
}
[data-vibeui-block="inputgroup-010"] [data-part="group"] > *:first-child{
margin-left:0;
border-radius:var(--vibeui-inputgroup-010-radius) 0 0 var(--vibeui-inputgroup-010-radius);
}
[data-vibeui-block="inputgroup-010"] [data-part="group"] > *:last-child{
border-radius:0 var(--vibeui-inputgroup-010-radius) var(--vibeui-inputgroup-010-radius) 0;
}
[data-vibeui-block="inputgroup-010"] [data-part="group"] > *:focus{
z-index:1;outline:2px solid var(--vibeui-inputgroup-010-accent);outline-offset:-1px;
border-color:var(--vibeui-inputgroup-010-accent);
}
/* Приставка неинтерактивна: её не выделяют, не читают отдельно и по ней
   нечего нажимать. Многоточие держит её в разумной ширине. */
[data-vibeui-block="inputgroup-010"] [data-part="prefix"]{
flex:0 1 auto;min-width:0;display:flex;align-items:center;padding:0 0.625rem;
background:var(--vibeui-inputgroup-010-fixed);
color:var(--vibeui-inputgroup-010-muted);
font-family:var(--vibeui-inputgroup-010-mono);font-size:0.8125rem;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:none;
}
[data-vibeui-block="inputgroup-010"] input{
flex:1 1 8rem;min-width:0;padding:0 0.75rem;
background:var(--vibeui-inputgroup-010-field);
font-family:var(--vibeui-inputgroup-010-mono);font-size:0.875rem;font-weight:600;
}
[data-vibeui-block="inputgroup-010"] [data-part="foot"]{
display:flex;align-items:baseline;justify-content:space-between;gap:0.5rem;
margin:0;font-size:0.75rem;line-height:1.4;color:var(--vibeui-inputgroup-010-muted);
}
[data-vibeui-block="inputgroup-010"] [data-part="foot"] b{
min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
font-family:var(--vibeui-inputgroup-010-mono);font-weight:650;
color:var(--vibeui-inputgroup-010-accent);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="inputgroup-010"] *{animation:none!important;transition:none!important}}
`

// Чистка на вводе, а не на отправке: адрес показывают человеку сразу.
function slugify(value: string) {
  return value
    .toLowerCase()
    .replace(/[\s_]+/g, "-")
    .replace(/[^a-z0-9-]/g, "")
    .replace(/-{2,}/g, "-")
    .slice(0, 32)
}

/**
 * Сцепка «приставка-домен + адрес»: приставку нельзя стереть, адрес чистится на лету.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Inputgroup010({
  label = "Адрес страницы",
  prefix = "vibeui.ru/",
  onChange,
  accent,
  className,
  style,
  ...props
}: Inputgroup010Props) {
  const id = useId()
  const [slug, setSlug] = useState("moya-komanda")

  const palette = {
    ...(accent ? { "--vibeui-inputgroup-010-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-inputgroup-010" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="inputgroup-010"
        className={className}
        style={palette}
      >
        <label htmlFor={id}>{label}</label>
        <div data-part="group">
          <span data-part="prefix" aria-hidden="true">
            {prefix}
          </span>
          <input
            id={id}
            name="slug"
            type="text"
            autoComplete="off"
            spellCheck={false}
            autoCapitalize="none"
            placeholder="moya-stranica"
            value={slug}
            aria-describedby={`${id}-foot`}
            onChange={(event) => {
              const next = slugify(event.target.value)
              setSlug(next)
              onChange?.(next)
            }}
          />
        </div>
        <p data-part="foot" id={`${id}-foot`}>
          <b>
            {prefix}
            {slug || "…"}
          </b>
          <span>{slug.length}/32</span>
        </p>
      </div>
    </>
  )
}