Display

Sticky Sections

Disclosures inside a scrolling card: the section heading sticks to the top and stays there until the next one pushes it away.

  • collapsible
  • sticky
  • scroll
  • sections

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-010?lang=en

Library12 компонентов
Ввод
  • Поле ввода
  • Автодополнение
  • Комбобокс
  • Переключатель
Отображение
  • Скелетон
  • Таймлайн
  • Дерево файлов
  • Блок кода
Навигация
  • Вкладки
  • Хлебные крошки
  • Командная палитра
  • Пагинация
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-010" (Sticky Sections) 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-010.json

Registry item: https://vibeui.ru/r/collapsible-010.json
Installs to: components/vibeui/collapsible-010.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
Disclosures inside a scrolling card: the section heading sticks to the top and stays there until the next one pushes it away.

A height-capped card holding several disclosures where the open section's heading sticks to the top of the scroll area. No client JS. Zero dependencies, one file.

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

<Collapsible010 title="Library" sections={[{ label: "Inputs", items: ["Text field"], open: true }]} />

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-010-* palette — do not swap it for your theme tokens
- the card's own scroll container: without it position:sticky pins to the window instead
- the opaque background on summary — otherwise list rows show through the sticky heading
- overscroll-behavior:contain: scrolling the card must not drag the page along
- the z-index on the sticky heading: without it the content covers it
- the light card surface — dark text is invisible on a dark showcase without it

## 6. You may change
- the heading through the title prop
- the sections array and its open flags
- the maximum scroll height
- the accent through the accent prop

## 7. Rules
- A sticky heading needs the card to have a capped height: with no max-height there is nothing to stick to.
- Open every section and several headings become sticky — they replace each other while scrolling, which is expected.
- List items are not interactive here: add links or buttons to match your navigation model.
- 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-010.json
https://vibeui.ru/r/collapsible-010.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-collapsible-010-*. Серверный: хуков нет. Прокрутка ограничена контейнером [data-part="scroll"] с max-height и overscroll-behavior:contain, а summary внутри него получает position:sticky и top:0 — прилипание работает только потому, что скролл-контейнер свой, а не окно. Общее число элементов считается из массива sections и выводится в шапке карточки.

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 Collapsible010Section = {
  label: string
  items: string[]
  open?: boolean
}

export type Collapsible010Props = Omit<
  ComponentPropsWithoutRef<"section">,
  "children" | "title"
> & {
  title?: string
  sections?: Collapsible010Section[]
  accent?: string
}

// Идея компонента: свёртки внутри карточки с ограниченной высотой. Как только
// у карточки появляется своя прокрутка, заголовок раскрытого раздела уезжает
// наверх и непонятно, что читаешь. Поэтому summary липнет к верху скролл-
// контейнера через position:sticky — прокрутка идёт у карточки, а не у окна,
// и заголовок остаётся на месте, пока не придёт следующий.
const STYLES = `
:where([data-vibeui-block="collapsible-010"]){
--vibeui-collapsible-010-bg:oklch(1 0 0);
--vibeui-collapsible-010-fg:oklch(0.24 0.014 265);
--vibeui-collapsible-010-muted:oklch(0.56 0.014 265);
--vibeui-collapsible-010-border:oklch(0.9 0.006 265);
--vibeui-collapsible-010-accent:oklch(0.55 0.2 300);
--vibeui-collapsible-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="collapsible-010"]{
display:flex;flex-direction:column;overflow:hidden;
box-sizing:border-box;width:100%;max-width:23rem;
background:var(--vibeui-collapsible-010-bg);color:var(--vibeui-collapsible-010-fg);
border:1px solid var(--vibeui-collapsible-010-border);border-radius:1rem;
font-family:var(--vibeui-collapsible-010-font);
}
[data-vibeui-block="collapsible-010"] [data-part="head"]{
display:flex;align-items:center;gap:0.5rem;
padding:0.8125rem 0.875rem;border-bottom:1px solid var(--vibeui-collapsible-010-border);
font-size:0.875rem;font-weight:700;
}
[data-vibeui-block="collapsible-010"] [data-part="total"]{
margin-left:auto;font-size:0.6875rem;font-weight:600;color:var(--vibeui-collapsible-010-muted);
}
/* Прокрутка живёт у карточки: только тогда sticky в ней имеет смысл. */
[data-vibeui-block="collapsible-010"] [data-part="scroll"]{
max-height:15rem;overflow-y:auto;overscroll-behavior:contain;
}
[data-vibeui-block="collapsible-010"] summary{
position:sticky;top:0;z-index:1;
display:flex;align-items:center;gap:0.5rem;
padding:0.5rem 0.875rem;cursor:pointer;list-style:none;
background:var(--vibeui-collapsible-010-bg);
border-bottom:1px solid var(--vibeui-collapsible-010-border);
font-size:0.75rem;font-weight:700;letter-spacing:0.04em;text-transform:uppercase;
color:var(--vibeui-collapsible-010-muted);
}
[data-vibeui-block="collapsible-010"] summary::-webkit-details-marker{display:none}
[data-vibeui-block="collapsible-010"] summary:focus-visible{outline:2px solid var(--vibeui-collapsible-010-accent);outline-offset:-2px}
[data-vibeui-block="collapsible-010"] details[open] summary{color:var(--vibeui-collapsible-010-accent)}
[data-vibeui-block="collapsible-010"] [data-part="mark"]{
flex:none;margin-left:auto;width:0.375rem;height:0.375rem;
border-right:2px solid currentColor;border-bottom:2px solid currentColor;
transform:rotate(-45deg);transform-origin:60% 60%;transition:transform .18s ease;
}
[data-vibeui-block="collapsible-010"] details[open] [data-part="mark"]{transform:rotate(45deg)}
[data-vibeui-block="collapsible-010"] ul{list-style:none;margin:0;padding:0.375rem 0.5rem}
[data-vibeui-block="collapsible-010"] li{
padding:0.375rem 0.5rem;border-radius:0.5rem;
font-size:0.8125rem;line-height:1.4;
}
[data-vibeui-block="collapsible-010"] li:hover{background:color-mix(in oklab,var(--vibeui-collapsible-010-accent) 8%,transparent)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="collapsible-010"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_SECTIONS: Collapsible010Section[] = [
  {
    label: "Ввод",
    items: ["Поле ввода", "Автодополнение", "Комбобокс", "Переключатель"],
    open: true,
  },
  {
    label: "Отображение",
    items: ["Скелетон", "Таймлайн", "Дерево файлов", "Блок кода"],
    open: true,
  },
  {
    label: "Навигация",
    items: ["Вкладки", "Хлебные крошки", "Командная палитра", "Пагинация"],
  },
]

/**
 * Свёртки внутри карточки с прокруткой: заголовок раздела липнет к верху
 * скролл-контейнера. Один файл, ноль зависимостей, клиентского кода нет.
 */
export function Collapsible010({
  title = "Библиотека",
  sections = DEFAULT_SECTIONS,
  accent,
  className,
  style,
  ...props
}: Collapsible010Props) {
  const total = sections.reduce((sum, section) => sum + section.items.length, 0)

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

  return (
    <>
      <style href="vibeui-collapsible-010" precedence="medium">
        {STYLES}
      </style>
      <section
        {...props}
        data-vibeui-block="collapsible-010"
        className={className}
        style={palette}
      >
        <header data-part="head">
          {title}
          <span data-part="total">{total} компонентов</span>
        </header>
        <div data-part="scroll">
          {sections.map((section) => (
            <details key={section.label} open={section.open}>
              <summary>
                {section.label}
                <span data-part="mark" aria-hidden="true" />
              </summary>
              <ul>
                {section.items.map((item) => (
                  <li key={item}>{item}</li>
                ))}
              </ul>
            </details>
          ))}
        </div>
      </section>
    </>
  )
}