Code Block

Read Only File

A listing of a generated file: a lock in the header, a diagonal hatch over the code and a note pointing at where the edits actually belong.

  • code
  • readonly
  • generated
  • light

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/codeblock-026?lang=en

только для чтенияregistry/index.ts
// сгенерировано, не править
export const ITEMS = [
  "codeblock-001",
  "codeblock-002",
  "codeblock-003",
]

The file is built by npm run indexesПравки внесите в registry/components/*/registry.json и пересоберите: ручные изменения здесь пропадут при следующей сборке.

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 "codeblock-026" (Read Only File) 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/codeblock-026.json

Registry item: https://vibeui.ru/r/codeblock-026.json
Installs to: components/vibeui/codeblock-026.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 listing of a generated file: a lock in the header, a diagonal hatch over the code and a note pointing at where the edits actually belong.

A light listing of a generated file marked read-only: a lock, a hatch and a pointer to the real place to edit. Zero dependencies, no client JS.

## 3. How to use it
import { Codeblock026 } from "@/components/vibeui/codeblock-026"

<Codeblock026
  path="registry/index.ts"
  reason="The file is built by npm run indexes"
  editInstead="registry/components/*/registry.json"
/>

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-codeblock-026-* palette — do not swap it for your theme tokens
- the hatch as a separate layer: dimming the text is wrong — people still read it
- pointer-events:none on the hatch layer, otherwise the code can no longer be selected
- the three cues in a row — lock, hatch and note: one of them is always missed
- the pointer to the real place to edit: a ban without an alternative is just annoying
- the block's own light surface: without it the dark code disappears on a dark page

## 6. You may change
- the file code through code
- the file path through path
- the reason for the ban through reason
- the real place to edit through editInstead

## 7. Rules
- The block enforces nothing: it is a warning for a human, not protection for the file.
- The hatch adds noise — for a long listing widen its step.
- There is deliberately no copy button: copying a generated file makes no sense.
- 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/codeblock-026.json
https://vibeui.ru/r/codeblock-026.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-codeblock-026-*. Серверный: хуков нет. Штриховка лежит отдельным слоем в ::after с pointer-events:none — приглушать сам текст нельзя, его читают, а выделять мышью он обязан оставаться. Запрет на правку заявлен трижды: значком с замком в шапке, штриховкой и подписью под кодом, где названо настоящее место правки. Блок светлый и несёт собственную подложку, чтобы тёмный код читался на любом фоне страницы.

Component source

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

import type { CSSProperties } from "react"

export type Codeblock026Props = {
  path?: string
  reason?: string
  editInstead?: string
  code?: string
  className?: string
  style?: CSSProperties
}

// Идея компонента: листинг, который нельзя править руками. Замок в шапке,
// косая штриховка поверх кода и подпись «правьте вот это вместо файла» —
// три сигнала подряд, потому что один читатель всегда пропускает.
const STYLES = `
:where([data-vibeui-block="codeblock-026"]){
--vibeui-codeblock-026-bg:oklch(0.985 0.003 265);
--vibeui-codeblock-026-code:oklch(0.96 0.005 265);
--vibeui-codeblock-026-fg:oklch(0.3 0.014 265);
--vibeui-codeblock-026-muted:oklch(0.53 0.012 265);
--vibeui-codeblock-026-border:oklch(0.89 0.008 265);
--vibeui-codeblock-026-lock:oklch(0.48 0.09 265);
--vibeui-codeblock-026-lock-bg:oklch(0.93 0.03 265);
--vibeui-codeblock-026-hatch:oklch(0.5 0.02 265 / 7%);
--vibeui-codeblock-026-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
--vibeui-codeblock-026-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="codeblock-026"]{
display:flex;flex-direction:column;
width:100%;max-width:32rem;box-sizing:border-box;margin:0;overflow:hidden;
border:1px solid var(--vibeui-codeblock-026-border);border-radius:0.75rem;
background:var(--vibeui-codeblock-026-bg);color:var(--vibeui-codeblock-026-fg);
font-family:var(--vibeui-codeblock-026-font);
}
[data-vibeui-block="codeblock-026"] [data-part="head"]{
display:flex;align-items:center;gap:0.5rem;flex-wrap:wrap;
padding:0.5rem 0.75rem;
border-bottom:1px solid var(--vibeui-codeblock-026-border);
font-family:var(--vibeui-codeblock-026-mono);font-size:0.75rem;
color:var(--vibeui-codeblock-026-muted);
}
[data-vibeui-block="codeblock-026"] [data-part="badge"]{
display:inline-flex;align-items:center;gap:0.3125rem;flex:none;
padding:0.1875rem 0.5rem;border-radius:999px;
background:var(--vibeui-codeblock-026-lock-bg);
color:var(--vibeui-codeblock-026-lock);
font-family:var(--vibeui-codeblock-026-font);
font-size:0.6875rem;font-weight:700;
}
[data-vibeui-block="codeblock-026"] svg{width:0.75rem;height:0.75rem;flex:none}
[data-vibeui-block="codeblock-026"] [data-part="path"]{margin-inline-start:auto}
/* Штриховка лежит отдельным слоем поверх кода: приглушать сам текст нельзя —
   он должен читаться, просто редактировать его бессмысленно. */
[data-vibeui-block="codeblock-026"] [data-part="body"]{
position:relative;background:var(--vibeui-codeblock-026-code);
}
[data-vibeui-block="codeblock-026"] [data-part="body"]::after{
content:"";position:absolute;inset:0;pointer-events:none;
background:repeating-linear-gradient(
135deg,
transparent 0 0.5rem,
var(--vibeui-codeblock-026-hatch) 0.5rem 0.625rem
);
}
[data-vibeui-block="codeblock-026"] pre{margin:0;padding:0.75rem 0.875rem;overflow-x:auto}
[data-vibeui-block="codeblock-026"] code{
display:block;min-width:max-content;
font-family:var(--vibeui-codeblock-026-mono);
font-size:0.8125rem;line-height:1.65;white-space:pre;
}
[data-vibeui-block="codeblock-026"] [data-part="note"]{
margin:0;padding:0.625rem 0.75rem;
border-top:1px solid var(--vibeui-codeblock-026-border);
font-size:0.75rem;line-height:1.5;color:var(--vibeui-codeblock-026-muted);
}
[data-vibeui-block="codeblock-026"] [data-part="note"] b{
display:block;margin-bottom:0.125rem;
color:var(--vibeui-codeblock-026-fg);font-weight:650;
}
[data-vibeui-block="codeblock-026"] [data-part="note"] code{
display:inline;min-width:0;
padding:0.0625rem 0.3125rem;border-radius:0.3125rem;
background:var(--vibeui-codeblock-026-code);
border:1px solid var(--vibeui-codeblock-026-border);
font-size:0.75rem;
}
`

const CODE = `// сгенерировано, не править
export const ITEMS = [
  "codeblock-001",
  "codeblock-002",
  "codeblock-003",
]`

/** Листинг сгенерированного файла с пометкой «только для чтения». */
export function Codeblock026({
  path = "registry/index.ts",
  reason = "Файл собирает команда npm run indexes",
  editInstead = "registry/components/*/registry.json",
  code = CODE,
  className,
  style,
}: Codeblock026Props) {
  return (
    <>
      <style href="vibeui-codeblock-026" precedence="medium">
        {STYLES}
      </style>
      <figure
        data-vibeui-block="codeblock-026"
        className={className}
        style={style}
      >
        <figcaption data-part="head">
          <span data-part="badge">
            <svg viewBox="0 0 12 12" aria-hidden="true">
              <rect
                x="2.5"
                y="5"
                width="7"
                height="5.5"
                rx="1.2"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.2"
              />
              <path
                d="M4.25 5V3.75a1.75 1.75 0 0 1 3.5 0V5"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.2"
              />
            </svg>
            только для чтения
          </span>
          <span data-part="path">{path}</span>
        </figcaption>
        <div data-part="body">
          <pre>
            <code>{code}</code>
          </pre>
        </div>
        <p data-part="note" role="note">
          <b>{reason}</b>
          Правки внесите в <code>{editInstead}</code> и пересоберите: ручные
          изменения здесь пропадут при следующей сборке.
        </p>
      </figure>
    </>
  )
}