Display
Guide Line Tree
An expanded structure with real guide lines: on the last node of a branch the vertical is cut to the elbow's height, so the line ends there instead of trailing into empty space.
- tree
- guides
- structure
- display
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/tree-008?lang=en
- dist412 КБ
- index.js184 КБ
- index.d.ts12 КБ
- chunks216 КБ
- vendor.js168 КБ
- runtime.js48 КБ
- src38 файлов
- index.ts
- types.ts
- utils.ts
- package.json2 КБ
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 "tree-008" (Guide Line Tree) 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/tree-008.json
Registry item: https://vibeui.ru/r/tree-008.json
Installs to: components/vibeui/tree-008.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
An expanded structure with real guide lines: on the last node of a branch the vertical is cut to the elbow's height, so the line ends there instead of trailing into empty space.
An expanded structure with level guides: the elbows are drawn by pseudo-elements, with no box-drawing characters in the text. Zero dependencies, one file, server rendered.
## 3. How to use it
import { Tree008 } from "@/components/vibeui/tree-008"
<Tree008
label="Package contents"
nodes={[{ name: "dist", note: "412 KB", children: [{ name: "index.js", note: "184 KB" }] }]}
/>
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-tree-008-* palette — do not swap it for your theme tokens
- cutting the vertical on the last node: without it the line trails into empty space
- drawing the elbows with pseudo-elements rather than ├ and └ — those end up in the clipboard on copy
- the row height in a variable: the elbow position is measured from it
- the tree, treeitem and group roles with aria-level: the lines draw structure for the eye only
- its own light surface: without it the dark names disappear on a dark background
## 6. You may change
- the structure through nodes, including the note on a node
- the tree caption through label
- the guide colour and weight through the line variable
- the level indent through the indent variable
## 7. Rules
- The tree is always expanded: there is no collapsing, this is a structure display, not navigation.
- A multiline name breaks the elbow position: it is measured from a fixed row height.
- aria-expanded on branches is always true — as it should be, there is nothing to collapse them with.
- 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/tree-008.jsonhttps://vibeui.ru/r/tree-008.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-tree-008-*. Серверный: хуков нет, дерево всегда развёрнуто. Уголок рисуют два псевдоэлемента узла: ::before — вертикаль ветки, ::after — поперечина на середине строки; у :last-child вертикаль укорачивается до половины строки, и получается ровно то, что печатает команда tree в терминале. Псевдографика не уходит в текст: символы ├ и └ попали бы в буфер обмена при копировании имён. Высота строки вынесена в переменную, потому что от неё считается положение поперечины. Роли tree, treeitem и group с aria-level описывают структуру, aria-expanded на ветках объявлено постоянно истинным.
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 Tree008Node = {
name: string
note?: string
children?: Tree008Node[]
}
export type Tree008Props = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
nodes?: Tree008Node[]
label?: string
}
// Идея компонента: развёрнутая структура с настоящими направляющими. Уголок
// каждого узла рисуют два псевдоэлемента — вертикаль и поперечина, — а у
// последнего в ветке вертикаль обрезается по высоте уголка, поэтому линия
// заканчивается на нём, а не уходит в пустоту. Это ровно то, что печатает
// tree в терминале, но без псевдографики в тексте: символы ├ и └ уехали бы
// в буфер обмена при копировании имён.
const STYLES = `
:where([data-vibeui-block="tree-008"]){
--vibeui-tree-008-bg:oklch(1 0 0);
--vibeui-tree-008-fg:oklch(0.24 0.014 265);
--vibeui-tree-008-muted:oklch(0.56 0.014 265);
--vibeui-tree-008-border:oklch(0.9 0.006 265);
--vibeui-tree-008-line:oklch(0.85 0.008 265);
--vibeui-tree-008-row:1.75rem;
--vibeui-tree-008-indent:0.875rem;
--vibeui-tree-008-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}
[data-vibeui-block="tree-008"]{
width:100%;max-width:22rem;box-sizing:border-box;padding:0.75rem 0.875rem;
background:var(--vibeui-tree-008-bg);
border:1px solid var(--vibeui-tree-008-border);border-radius:0.875rem;
font-family:var(--vibeui-tree-008-mono);font-size:0.8125rem;
color:var(--vibeui-tree-008-fg);
}
[data-vibeui-block="tree-008"] ul{margin:0;padding:0;list-style:none}
[data-vibeui-block="tree-008"] [role="group"] > li{
position:relative;padding-left:calc(var(--vibeui-tree-008-indent) + 0.375rem);
}
/* Вертикаль ветки: у последнего узла она обрезается по высоте уголка. */
[data-vibeui-block="tree-008"] [role="group"] > li::before{
content:"";position:absolute;left:0;top:0;bottom:0;
width:1px;background:var(--vibeui-tree-008-line);
}
[data-vibeui-block="tree-008"] [role="group"] > li:last-child::before{
bottom:auto;height:calc(var(--vibeui-tree-008-row) / 2);
}
/* Поперечина уголка: середина строки, ширина отступа уровня. */
[data-vibeui-block="tree-008"] [role="group"] > li::after{
content:"";position:absolute;left:0;
top:calc(var(--vibeui-tree-008-row) / 2);
width:var(--vibeui-tree-008-indent);height:1px;
background:var(--vibeui-tree-008-line);
}
[data-vibeui-block="tree-008"] [data-part="row"]{
display:flex;align-items:center;gap:0.4375rem;
height:var(--vibeui-tree-008-row);
}
[data-vibeui-block="tree-008"] [data-part="name"]{
min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="tree-008"] li[data-branch="true"] > [data-part="row"] [data-part="name"]{
font-weight:700;
}
[data-vibeui-block="tree-008"] [data-part="note"]{
margin-left:auto;padding-left:0.5rem;
color:var(--vibeui-tree-008-muted);font-size:0.6875rem;
font-variant-numeric:tabular-nums;white-space:nowrap;
}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="tree-008"] *{animation:none!important;transition:none!important}
}
`
const DEFAULT_NODES: Tree008Node[] = [
{
name: "dist",
note: "412 КБ",
children: [
{ name: "index.js", note: "184 КБ" },
{ name: "index.d.ts", note: "12 КБ" },
{
name: "chunks",
note: "216 КБ",
children: [
{ name: "vendor.js", note: "168 КБ" },
{ name: "runtime.js", note: "48 КБ" },
],
},
],
},
{
name: "src",
note: "38 файлов",
children: [
{ name: "index.ts" },
{ name: "types.ts" },
{ name: "utils.ts" },
],
},
{ name: "package.json", note: "2 КБ" },
]
function renderNodes(nodes: Tree008Node[], level: number) {
return nodes.map((node) => {
const branch = Boolean(node.children?.length)
return (
<li
key={node.name}
role="treeitem"
aria-level={level}
aria-expanded={branch ? true : undefined}
aria-selected={false}
data-branch={branch || undefined}
>
<span data-part="row">
<span data-part="name">{node.name}</span>
{node.note ? <span data-part="note">{node.note}</span> : null}
</span>
{branch ? (
<ul role="group" aria-label={node.name}>
{renderNodes(node.children!, level + 1)}
</ul>
) : null}
</li>
)
})
}
/**
* Развёрнутая структура с направляющими линиями уровней.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Tree008({
nodes = DEFAULT_NODES,
label = "Состав пакета",
className,
style,
...props
}: Tree008Props) {
return (
<>
<style href="vibeui-tree-008" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="tree-008"
className={className}
style={style as CSSProperties}
>
<ul role="tree" aria-label={label}>
{renderNodes(nodes, 1)}
</ul>
</div>
</>
)
}