Inputs

Folder Target

A cascading folder picker for moving a file: any level can be the target, a dedicated "up" row leads back, and the source folder is locked.

  • cascader
  • folders
  • picker
  • files

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/cascader-009?lang=en

Переместить quarterly-report.pdf

Корень диска / Проекты

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 "cascader-009" (Folder Target) 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/cascader-009.json

Registry item: https://vibeui.ru/r/cascader-009.json
Installs to: components/vibeui/cascader-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 cascading folder picker for moving a file: any level can be the target, a dedicated "up" row leads back, and the source folder is locked.

A destination folder picker as a cascader: an "up" row, file counts, a locked source folder and an action button naming the current folder. One file, zero dependencies.

## 3. How to use it
import { Cascader009 } from "@/components/vibeui/cascader-009"

<Cascader009 fileName="quarterly-report.pdf" actionLabel="Move into" />

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-cascader-009-* palette — do not swap it for your theme tokens
- the action button enabled on every level: the destination is any folder, not only a final one
- the current folder name on the button — "Move here" without a name leads to misplaced files
- the "up" row as its own list target: that is how people go back in file dialogs
- the visible but disabled source folder: a row that vanishes reads as lost data
- the panel's own light surface: dark text disappears on the dark catalogue card

## 6. You may change
- the moved file name through fileName
- the action caption through actionLabel
- the folder tree and its counts through tree
- the accent colour through accent

## 7. Rules
- An empty folder shows only the "up" row — correct behaviour, but an empty-state caption is worth adding.
- Locking comes from a locked flag in the data: the component does not know where the file is moved from.
- The panel is meant to sit inside a dialog: it brings no backdrop and no focus trap of its own.
- 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/cascader-009.json
https://vibeui.ru/r/cascader-009.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-cascader-009-*. Клиентский: текущий путь живёт в useState. В отличие от обычного каскада целью здесь может быть промежуточный узел, поэтому кнопка действия активна на каждом шаге и всегда называет текущую папку. Возврат сделан отдельной строкой списка, а не крошкой: в файловых диалогах это привычный жест. Заблокированная папка остаётся видимой с подписью «источник» — исчезнувшая строка читается как потеря данных.

Component source

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

"use client"

import { useState } from "react"
import type { CSSProperties } from "react"

export type Cascader009Folder = {
  label: string
  files?: number
  locked?: boolean
  children?: Cascader009Folder[]
}

export type Cascader009Props = {
  fileName?: string
  actionLabel?: string
  tree?: Cascader009Folder[]
  accent?: string
  className?: string
  style?: CSSProperties
}

// Идея компонента: каскад как выбор папки назначения. Здесь важен не листовой
// узел, а любая точка дерева: положить файл можно и в промежуточную папку,
// поэтому кнопка действия работает на каждом шаге и всегда называет текущую
// папку. Строка «наверх» — отдельная цель, а не крошка: в файловых диалогах
// это привычный путь возврата. Папка-источник заблокирована: переместить
// файл туда, где он уже лежит, — пустое действие с непонятным результатом.
const STYLES = `
:where([data-vibeui-block="cascader-009"]){
--vibeui-cascader-009-bg:oklch(1 0 0);
--vibeui-cascader-009-panel:oklch(0.975 0.004 250);
--vibeui-cascader-009-fg:oklch(0.23 0.014 250);
--vibeui-cascader-009-muted:oklch(0.55 0.012 250);
--vibeui-cascader-009-border:oklch(0.9 0.006 250);
--vibeui-cascader-009-accent:oklch(0.55 0.18 255);
--vibeui-cascader-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="cascader-009"]{
display:flex;flex-direction:column;gap:0.625rem;
width:100%;max-width:22rem;box-sizing:border-box;padding:0.875rem;
background:var(--vibeui-cascader-009-bg);color:var(--vibeui-cascader-009-fg);
border:1px solid var(--vibeui-cascader-009-border);border-radius:1rem;
font-family:var(--vibeui-cascader-009-font);
box-shadow:0 22px 48px -34px oklch(0.2 0.03 250 / 65%);
}
[data-vibeui-block="cascader-009"] *{box-sizing:border-box}
[data-vibeui-block="cascader-009"] [data-part="title"]{
margin:0;font-size:0.875rem;font-weight:650;letter-spacing:-0.01em;
}
[data-vibeui-block="cascader-009"] [data-part="title"] em{
font-style:normal;color:var(--vibeui-cascader-009-accent);
}
[data-vibeui-block="cascader-009"] [data-part="where"]{
margin:0;font-size:0.6875rem;color:var(--vibeui-cascader-009-muted);
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="cascader-009"] [data-part="list"]{
display:flex;flex-direction:column;gap:0.125rem;margin:0;padding:0.25rem;
list-style:none;height:10.5rem;overflow:auto;overscroll-behavior:contain;
background:var(--vibeui-cascader-009-panel);
border:1px solid var(--vibeui-cascader-009-border);border-radius:0.75rem;
}
[data-vibeui-block="cascader-009"] [data-part="row"]{
display:flex;align-items:center;gap:0.5rem;width:100%;
padding:0.375rem 0.5rem;border:0;border-radius:0.5rem;
background:transparent;color:inherit;font:inherit;font-size:0.8125rem;
text-align:left;cursor:pointer;
transition:background-color .14s ease;
}
[data-vibeui-block="cascader-009"] [data-part="row"]:hover:not(:disabled){
background:color-mix(in oklab,var(--vibeui-cascader-009-accent) 10%,transparent);
}
[data-vibeui-block="cascader-009"] [data-part="row"]:focus-visible{
outline:2px solid var(--vibeui-cascader-009-accent);outline-offset:-2px;
}
[data-vibeui-block="cascader-009"] [data-part="row"]:disabled{
opacity:.45;cursor:not-allowed;
}
[data-vibeui-block="cascader-009"] [data-part="row"] span{
flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="cascader-009"] [data-part="count"]{
flex:0 0 auto;font-size:0.6875rem;color:var(--vibeui-cascader-009-muted);
}
[data-vibeui-block="cascader-009"] [data-part="icon"]{
flex:0 0 auto;width:0.875rem;height:0.6875rem;border-radius:0.1875rem 0.1875rem 0.125rem 0.125rem;
background:color-mix(in oklab,var(--vibeui-cascader-009-accent) 30%,transparent);
position:relative;
}
[data-vibeui-block="cascader-009"] [data-part="icon"]::before{
content:"";position:absolute;top:-0.1875rem;left:0;width:0.4375rem;height:0.1875rem;
border-radius:0.125rem 0.125rem 0 0;
background:color-mix(in oklab,var(--vibeui-cascader-009-accent) 30%,transparent);
}
[data-vibeui-block="cascader-009"] [data-part="up"]{
font-weight:600;color:var(--vibeui-cascader-009-muted);
}
[data-vibeui-block="cascader-009"] [data-part="up-icon"]{
flex:0 0 auto;width:0.4375rem;height:0.4375rem;
border-left:1.5px solid currentColor;border-top:1.5px solid currentColor;
transform:rotate(45deg) translate(0.0625rem,0.0625rem);
}
[data-vibeui-block="cascader-009"] [data-part="foot"]{
display:flex;gap:0.375rem;
}
[data-vibeui-block="cascader-009"] [data-part="cancel"],
[data-vibeui-block="cascader-009"] [data-part="move"]{
padding:0.5rem 0.75rem;border-radius:0.625rem;font:inherit;font-size:0.8125rem;
cursor:pointer;transition:opacity .14s ease,border-color .14s ease;
}
[data-vibeui-block="cascader-009"] [data-part="cancel"]{
border:1px solid var(--vibeui-cascader-009-border);
background:var(--vibeui-cascader-009-bg);color:var(--vibeui-cascader-009-muted);
}
[data-vibeui-block="cascader-009"] [data-part="move"]{
flex:1 1 auto;min-width:0;border:0;font-weight:600;
background:var(--vibeui-cascader-009-accent);color:oklch(1 0 0);
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
[data-vibeui-block="cascader-009"] [data-part="move"]:disabled{opacity:.45;cursor:not-allowed}
[data-vibeui-block="cascader-009"] [data-part="cancel"]:focus-visible,
[data-vibeui-block="cascader-009"] [data-part="move"]:focus-visible{
outline:2px solid var(--vibeui-cascader-009-accent);outline-offset:2px;
}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="cascader-009"] *{animation:none!important;transition:none!important}
}
`

const DEFAULT_TREE: Cascader009Folder[] = [
  {
    label: "Проекты",
    files: 18,
    children: [
      {
        label: "Витрина 2026",
        files: 9,
        children: [
          { label: "Макеты", files: 24 },
          { label: "Исследования", files: 6 },
        ],
      },
      { label: "Архив", files: 132, children: [{ label: "2024", files: 71 }] },
    ],
  },
  {
    label: "Входящие",
    files: 3,
    locked: true,
  },
  {
    label: "Команда",
    files: 11,
    children: [
      { label: "Онбординг", files: 7 },
      { label: "Регламенты", files: 15 },
    ],
  },
]

function foldersAt(tree: Cascader009Folder[], path: string[]) {
  let nodes = tree

  for (const step of path) {
    const found = nodes.find((node) => node.label === step)

    if (!found?.children?.length) {
      return [] as Cascader009Folder[]
    }

    nodes = found.children
  }

  return nodes
}

/**
 * Выбор папки для перемещения файла: каскад, где целью может быть любой уровень.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Cascader009({
  fileName = "отчёт-за-квартал.pdf",
  actionLabel = "Переместить в",
  tree = DEFAULT_TREE,
  accent,
  className,
  style,
}: Cascader009Props) {
  const [path, setPath] = useState<string[]>(["Проекты"])
  const folders = foldersAt(tree, path)
  const here = path.length ? path[path.length - 1] : "Корень диска"

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

  return (
    <>
      <style href="vibeui-cascader-009" precedence="medium">
        {STYLES}
      </style>
      <div
        data-vibeui-block="cascader-009"
        className={className}
        style={palette}
        role="group"
        aria-label={`Перемещение файла ${fileName}`}
      >
        <p data-part="title">
          Переместить <em>{fileName}</em>
        </p>
        <p data-part="where" aria-live="polite">
          {["Корень диска", ...path].join(" / ")}
        </p>
        <ul data-part="list">
          {path.length ? (
            <li>
              <button
                data-part="row"
                type="button"
                onClick={() => setPath(path.slice(0, -1))}
              >
                <i data-part="up-icon" aria-hidden="true" />
                <span data-part="up">Наверх</span>
              </button>
            </li>
          ) : null}
          {folders.map((folder) => (
            <li key={folder.label}>
              <button
                data-part="row"
                type="button"
                disabled={folder.locked}
                onClick={() => setPath([...path, folder.label])}
              >
                <i data-part="icon" aria-hidden="true" />
                <span>{folder.label}</span>
                <span data-part="count">
                  {folder.locked ? "источник" : `${folder.files ?? 0} файлов`}
                </span>
              </button>
            </li>
          ))}
        </ul>
        <div data-part="foot">
          <button data-part="cancel" type="button">
            Отмена
          </button>
          <button data-part="move" type="button">
            {actionLabel} «{here}»
          </button>
        </div>
      </div>
    </>
  )
}