Display

Icon Rail

A sidebar that collapses into a narrow icon rail rather than to zero, so navigation stays reachable in both states.

  • collapsible
  • sidebar
  • rail
  • navigation

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/collapsible-007?lang=en

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 "collapsible-007" (Icon Rail) 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/collapsible-007.json

Registry item: https://vibeui.ru/r/collapsible-007.json
Installs to: components/vibeui/collapsible-007.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 sidebar that collapses into a narrow icon rail rather than to zero, so navigation stays reachable in both states.

A sidebar collapsing to an icon rail: the width animates through a single variable and labels shrink away but stay in the DOM for accessible names. Zero dependencies, one file.

## 3. How to use it
import { Collapsible007 } from "@/components/vibeui/collapsible-007"

<Collapsible007 title="VibeUI" items={[{ label: "Catalog", glyph: "▦" }]} />

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-collapsible-007-* palette — do not swap it for your theme tokens
- keeping labels in the DOM while collapsed: removing them strips the buttons of accessible names
- the single width variable driving the transition — otherwise the animation splits across properties
- aria-expanded on the toggle: it reports the state of the whole panel
- a visible icon while collapsed — a panel shrunk to zero takes navigation away
- the light surface and border: nothing is visible on a dark showcase without them

## 6. You may change
- the product name through the title prop
- the items array with labels and glyphs
- the initial state through the defaultCollapsed prop
- the rail width and the accent through the accent prop

## 7. Rules
- The glyphs are plain text: swap in your own SVG icons if you need consistent stroke weights.
- aria-current="page" sits on the first item as an example — wire it to your router.
- The collapsed rail relies on the button title: a real keyboard-accessible tooltip is a separate addition.
- 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/collapsible-007.json
https://vibeui.ru/r/collapsible-007.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-collapsible-007-*. Клиентский: "use client" ради useState. Ширина панели едет по переменной --vibeui-collapsible-007-width, которую переопределяет селектор [data-collapsed="true"] — переход описан одним свойством. Подписи не размонтируются, а схлопываются нулевой шириной с overflow:hidden, поэтому доступное имя кнопки сохраняется и порядок табуляции не меняется. В свёрнутом виде подпись дублируется в title кнопки.

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 { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Collapsible007Item = {
  label: string
  glyph: string
  badge?: string
}

export type Collapsible007Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "title"
> & {
  title?: string
  items?: Collapsible007Item[]
  defaultCollapsed?: boolean
  accent?: string
}

// Идея компонента: панель, которая сворачивается не в ноль, а в узкую полосу
// иконок — навигация остаётся доступной и в свёрнутом виде. Ширина едет по
// одной переменной, подписи не размонтируются, а прячутся нулевой шириной с
// overflow:hidden: тогда переход плавный, а порядок табуляции не скачет.
// В свёрнутом состоянии подпись уходит в title и aria-label кнопки.
const STYLES = `
:where([data-vibeui-block="collapsible-007"]){
--vibeui-collapsible-007-bg:oklch(1 0 0);
--vibeui-collapsible-007-fg:oklch(0.24 0.014 265);
--vibeui-collapsible-007-muted:oklch(0.55 0.014 265);
--vibeui-collapsible-007-border:oklch(0.9 0.006 265);
--vibeui-collapsible-007-accent:oklch(0.55 0.19 262);
--vibeui-collapsible-007-width:14rem;
--vibeui-collapsible-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="collapsible-007"]{
display:flex;box-sizing:border-box;width:100%;max-width:14rem;
font-family:var(--vibeui-collapsible-007-font);
}
[data-vibeui-block="collapsible-007"] [data-part="rail"]{
display:flex;flex-direction:column;gap:0.25rem;
box-sizing:border-box;padding:0.5rem;
width:var(--vibeui-collapsible-007-width);
background:var(--vibeui-collapsible-007-bg);color:var(--vibeui-collapsible-007-fg);
border:1px solid var(--vibeui-collapsible-007-border);border-radius:1rem;
transition:width .26s cubic-bezier(.32,.72,0,1);
}
[data-vibeui-block="collapsible-007"] [data-part="rail"][data-collapsed="true"]{--vibeui-collapsible-007-width:3.5rem}
[data-vibeui-block="collapsible-007"] [data-part="head"]{
display:flex;align-items:center;gap:0.5rem;padding:0.25rem 0.25rem 0.5rem;
}
[data-vibeui-block="collapsible-007"] [data-part="brand"]{
font-size:0.8125rem;font-weight:700;white-space:nowrap;
}
[data-vibeui-block="collapsible-007"] [data-part="toggle"]{
display:grid;place-items:center;flex:none;margin-left:auto;
width:1.75rem;height:1.75rem;border-radius:0.5rem;
appearance:none;border:1px solid var(--vibeui-collapsible-007-border);
background:none;color:var(--vibeui-collapsible-007-muted);cursor:pointer;
}
[data-vibeui-block="collapsible-007"] [data-part="toggle"]:focus-visible{outline:2px solid var(--vibeui-collapsible-007-accent);outline-offset:2px}
[data-vibeui-block="collapsible-007"] [data-part="toggle"] span{
width:0.4375rem;height:0.4375rem;
border-left:2px solid currentColor;border-bottom:2px solid currentColor;
transform:rotate(45deg);transition:transform .22s ease;
}
[data-vibeui-block="collapsible-007"] [data-part="rail"][data-collapsed="true"] [data-part="toggle"] span{transform:rotate(-135deg)}
[data-vibeui-block="collapsible-007"] [data-part="row"]{
display:flex;align-items:center;gap:0.625rem;
box-sizing:border-box;width:100%;padding:0.4375rem 0.5rem;
appearance:none;border:0;background:none;cursor:pointer;text-align:left;
border-radius:0.625rem;color:var(--vibeui-collapsible-007-muted);
font:inherit;font-size:0.8125rem;
}
[data-vibeui-block="collapsible-007"] [data-part="row"]:hover{background:color-mix(in oklab,var(--vibeui-collapsible-007-accent) 8%,transparent);color:var(--vibeui-collapsible-007-fg)}
[data-vibeui-block="collapsible-007"] [data-part="row"]:focus-visible{outline:2px solid var(--vibeui-collapsible-007-accent);outline-offset:-2px}
[data-vibeui-block="collapsible-007"] [data-part="row"][aria-current="page"]{background:color-mix(in oklab,var(--vibeui-collapsible-007-accent) 14%,transparent);color:var(--vibeui-collapsible-007-accent);font-weight:650}
[data-vibeui-block="collapsible-007"] [data-part="glyph"]{
flex:none;display:grid;place-items:center;width:1.25rem;font-size:0.9375rem;line-height:1;
}
/* Подпись не размонтируется: нулевая ширина + overflow даёт плавный переход. */
[data-vibeui-block="collapsible-007"] [data-part="label"]{
flex:1;min-width:0;overflow:hidden;white-space:nowrap;
opacity:1;transition:opacity .18s ease;
}
[data-vibeui-block="collapsible-007"] [data-part="badge"]{
flex:none;padding:0 0.375rem;border-radius:9999px;
background:var(--vibeui-collapsible-007-accent);color:oklch(1 0 0);
font-size:0.625rem;font-weight:700;line-height:1.15rem;
}
[data-vibeui-block="collapsible-007"] [data-part="rail"][data-collapsed="true"] [data-part="brand"],
[data-vibeui-block="collapsible-007"] [data-part="rail"][data-collapsed="true"] [data-part="label"],
[data-vibeui-block="collapsible-007"] [data-part="rail"][data-collapsed="true"] [data-part="badge"]{
flex:none;width:0;padding:0;opacity:0;overflow:hidden;
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="collapsible-007"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_ITEMS: Collapsible007Item[] = [
  { label: "Каталог", glyph: "▦" },
  { label: "Компоненты", glyph: "◍", badge: "24" },
  { label: "Реестр", glyph: "⌗" },
  { label: "Настройки", glyph: "⚙" },
]

/**
 * Боковая панель, сворачивающаяся в полосу иконок: ширина едет по одной
 * переменной, подписи не размонтируются. Один файл, ноль зависимостей.
 */
export function Collapsible007({
  title = "VibeUI",
  items = DEFAULT_ITEMS,
  defaultCollapsed = false,
  accent,
  className,
  style,
  ...props
}: Collapsible007Props) {
  const [collapsed, setCollapsed] = useState(defaultCollapsed)

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

  return (
    <>
      <style href="vibeui-collapsible-007" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="collapsible-007"
        className={className}
        style={palette}
      >
        <nav data-part="rail" data-collapsed={collapsed} aria-label={title}>
          <div data-part="head">
            <span data-part="brand">{title}</span>
            <button
              type="button"
              data-part="toggle"
              aria-expanded={!collapsed}
              aria-label={collapsed ? "Развернуть панель" : "Свернуть панель"}
              onClick={() => setCollapsed((value) => !value)}
            >
              <span aria-hidden="true" />
            </button>
          </div>
          {items.map((item, index) => (
            <button
              key={item.label}
              type="button"
              data-part="row"
              title={collapsed ? item.label : undefined}
              aria-current={index === 0 ? "page" : undefined}
            >
              <span data-part="glyph" aria-hidden="true">
                {item.glyph}
              </span>
              <span data-part="label">{item.label}</span>
              {item.badge ? <span data-part="badge">{item.badge}</span> : null}
            </button>
          ))}
        </nav>
      </div>
    </>
  )
}