Code Block
File Path Header
A light code block whose header is the file path: folders are muted, the file name stands out, the extension becomes a badge and the status sits on the right.
- code
- filename
- breadcrumb
- light
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/codeblock-009?lang=en
- app
- (site)
- layout.tsx
export const metadata = {
title: "VibeUI",
description: "Компоненты для вайбкодинга",
}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-009" (File Path Header) 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-009.json
Registry item: https://vibeui.ru/r/codeblock-009.json
Installs to: components/vibeui/codeblock-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 light code block whose header is the file path: folders are muted, the file name stands out, the extension becomes a badge and the status sits on the right.
A light code block with a header: the path in segments, an extension badge and a file status. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Codeblock009 } from "@/components/vibeui/codeblock-009"
<Codeblock009
path="app/(site)/layout.tsx"
status="changed"
/>
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-009-* palette — do not swap it for your theme tokens
- the block's own light surface: without it the dark code disappears on a dark page
- the emphasis on the last path segment: in a long path the file name gets lost otherwise
- deriving the extension from the path itself — a hand-set badge eventually lies
- the separators in ::after: in the markup they get in the way of copying the path
- the two surfaces: the header is lighter than the code area, or the block reads as one rectangle
## 6. You may change
- the file path through path and the code through code
- the file status through status
- the colours of the extension badge and the status chip
- the block width and corner radius
## 7. Rules
- A very long path is ellipsised on the leading segments: the file name always survives.
- Status is free text: it has a single colour and carries no success or failure semantics.
- A path without slashes becomes a single segment — normal behaviour, not a bug.
- 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-009.jsonhttps://vibeui.ru/r/codeblock-009.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-codeblock-009-*. Серверный: хуков нет. Путь режется по слэшу в список ol, разделители печатает ::after, а последний сегмент красится и утолщается — так имя файла видно в длинном пути. Расширение вычисляется из того же пути, поэтому значок не может разойтись с именем. Блок светлый и несёт собственную белую подложку, чтобы тёмный код читался на любом фоне страницы.
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 Codeblock009Props = Omit<
ComponentPropsWithoutRef<"figure">,
"children"
> & {
path?: string
status?: string
code?: string
}
// Идея компонента: светлый блок кода, у которого шапка — это путь к файлу.
// Путь разложен на сегменты: каталоги приглушены, имя файла выделено, а
// расширение вынесено в отдельный значок, поэтому файл узнаётся с одного
// взгляда даже в длинном пути.
const STYLES = `
:where([data-vibeui-block="codeblock-009"]){
--vibeui-codeblock-009-bg:oklch(1 0 0);
--vibeui-codeblock-009-code-bg:oklch(0.975 0.003 265);
--vibeui-codeblock-009-fg:oklch(0.26 0.016 265);
--vibeui-codeblock-009-muted:oklch(0.56 0.014 265);
--vibeui-codeblock-009-border:oklch(0.9 0.006 265);
--vibeui-codeblock-009-badge-bg:oklch(0.93 0.04 250);
--vibeui-codeblock-009-badge-fg:oklch(0.42 0.13 255);
--vibeui-codeblock-009-status-bg:oklch(0.94 0.05 85);
--vibeui-codeblock-009-status-fg:oklch(0.45 0.11 70);
--vibeui-codeblock-009-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
--vibeui-codeblock-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="codeblock-009"]{
display:flex;flex-direction:column;
width:100%;max-width:32rem;box-sizing:border-box;margin:0;overflow:hidden;
border:1px solid var(--vibeui-codeblock-009-border);border-radius:0.75rem;
background:var(--vibeui-codeblock-009-bg);color:var(--vibeui-codeblock-009-fg);
font-family:var(--vibeui-codeblock-009-font);
}
[data-vibeui-block="codeblock-009"] figcaption{
display:flex;align-items:center;gap:0.5rem;
padding:0.5rem 0.75rem;border-bottom:1px solid var(--vibeui-codeblock-009-border);
}
[data-vibeui-block="codeblock-009"] [data-part="badge"]{
flex:none;padding:0.1875rem 0.375rem;border-radius:0.3125rem;
background:var(--vibeui-codeblock-009-badge-bg);color:var(--vibeui-codeblock-009-badge-fg);
font-size:0.625rem;font-weight:800;letter-spacing:0.06em;text-transform:uppercase;
}
[data-vibeui-block="codeblock-009"] [data-part="crumbs"]{
display:flex;align-items:baseline;min-width:0;flex:1 1 auto;
margin:0;padding:0;list-style:none;
font-family:var(--vibeui-codeblock-009-mono);font-size:0.75rem;
}
[data-vibeui-block="codeblock-009"] [data-part="crumbs"] li{
color:var(--vibeui-codeblock-009-muted);white-space:nowrap;
overflow:hidden;text-overflow:ellipsis;
}
[data-vibeui-block="codeblock-009"] [data-part="crumbs"] li::after{content:"/";margin:0 0.25rem;opacity:.5}
[data-vibeui-block="codeblock-009"] [data-part="crumbs"] li:last-child{
color:var(--vibeui-codeblock-009-fg);font-weight:650;flex:0 1 auto;
}
[data-vibeui-block="codeblock-009"] [data-part="crumbs"] li:last-child::after{content:none}
[data-vibeui-block="codeblock-009"] [data-part="status"]{
flex:none;padding:0.1875rem 0.4375rem;border-radius:999px;
background:var(--vibeui-codeblock-009-status-bg);color:var(--vibeui-codeblock-009-status-fg);
font-size:0.6875rem;font-weight:700;
}
[data-vibeui-block="codeblock-009"] pre{
margin:0;padding:0.875rem;overflow-x:auto;
background:var(--vibeui-codeblock-009-code-bg);
}
[data-vibeui-block="codeblock-009"] code{
display:block;
font-family:var(--vibeui-codeblock-009-mono);
font-size:0.8125rem;line-height:1.65;white-space:pre;
}
`
const CODE = `export const metadata = {
title: "VibeUI",
description: "Компоненты для вайбкодинга",
}`
/** Светлый блок кода с шапкой: путь к файлу, расширение и статус. */
export function Codeblock009({
path = "app/(site)/layout.tsx",
status = "изменён",
code = CODE,
className,
style,
...props
}: Codeblock009Props) {
const segments = path.split("/").filter(Boolean)
const file = segments[segments.length - 1] ?? path
const extension = file.includes(".") ? file.split(".").pop() : "txt"
return (
<>
<style href="vibeui-codeblock-009" precedence="medium">
{STYLES}
</style>
<figure
{...props}
data-vibeui-block="codeblock-009"
className={className}
style={style as CSSProperties}
>
<figcaption>
<span data-part="badge">{extension}</span>
<ol data-part="crumbs" aria-label={`Путь к файлу: ${path}`}>
{segments.map((segment, index) => (
<li key={index}>{segment}</li>
))}
</ol>
{status ? <span data-part="status">{status}</span> : null}
</figcaption>
<pre>
<code>{code}</code>
</pre>
</figure>
</>
)
}