Display

Native Disclosure

A basic disclosure on a native details element: the state lives in the markup, there is no client code, and it works before hydration.

  • collapsible
  • details
  • no-js
  • disclosure

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

How the component is installed30 seconds

Скопируйте команду из карточки, выполните её в корне проекта — файл ляжет в components/vibeui и сразу заработает: внешних зависимостей у него нет.

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-001" (Native Disclosure) 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-001.json

Registry item: https://vibeui.ru/r/collapsible-001.json
Installs to: components/vibeui/collapsible-001.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 basic disclosure on a native details element: the state lives in the markup, there is no client code, and it works before hydration.

A disclosure on native details and summary: a heading with a hint, a rotating marker and body text under a rule. No client JS, the markup holds the state. Zero dependencies, one file.

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

<Collapsible001 title="How the component is installed" hint="30 seconds" />

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-001-* palette — do not swap it for your theme tokens
- native details/summary: a button with useState loses find-in-page and pre-hydration behaviour
- hiding the system marker along with drawing your own — otherwise there are two arrows
- rotating the marker via the [open] selector instead of swapping glyphs: the state stays in CSS
- the focus-visible outline on summary with a negative offset: headings get tabbed through
- the light surface and border — without them the text is unreadable on a dark showcase

## 6. You may change
- the heading through the title prop
- the trailing hint through the hint prop
- the body copy through the text prop
- the accent through the accent prop and the block width

## 7. Rules
- There is deliberately no open animation: native details snaps, smooth height needs different machinery.
- The open attribute goes straight to details: it is the state, no separate React state is needed.
- Do not put interactive elements inside summary: clicking them still toggles the disclosure.
- 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-001.json
https://vibeui.ru/r/collapsible-001.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-collapsible-001-*. Серверный: хуков нет, корень блока — сам элемент details. Системный маркер снят через list-style:none и ::-webkit-details-marker, вместо него нарисован значок из двух граней квадрата, поворот привязан к селектору [open]. Подсказка справа прижата margin-left:auto, поэтому при её отсутствии значок берёт auto на себя через :only-child.

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 Collapsible001Props = Omit<
  ComponentPropsWithoutRef<"details">,
  "children" | "title"
> & {
  title?: string
  hint?: string
  text?: string
  accent?: string
}

// Идея компонента: самая простая свёртка — один <details> без единой строки
// клиентского кода. Состояние живёт в разметке, поэтому раскрытие работает
// до гидратации, попадает в поиск по странице и печатается развёрнутым.
// Значок нарисован двумя гранями квадрата: подменять символ на ± не нужно.
const STYLES = `
:where([data-vibeui-block="collapsible-001"]){
--vibeui-collapsible-001-bg:oklch(1 0 0);
--vibeui-collapsible-001-fg:oklch(0.24 0.014 265);
--vibeui-collapsible-001-muted:oklch(0.56 0.014 265);
--vibeui-collapsible-001-border:oklch(0.9 0.006 265);
--vibeui-collapsible-001-accent:oklch(0.55 0.19 262);
--vibeui-collapsible-001-radius:0.875rem;
--vibeui-collapsible-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="collapsible-001"]{
display:block;box-sizing:border-box;width:100%;max-width:24rem;
background:var(--vibeui-collapsible-001-bg);color:var(--vibeui-collapsible-001-fg);
border:1px solid var(--vibeui-collapsible-001-border);
border-radius:var(--vibeui-collapsible-001-radius);
font-family:var(--vibeui-collapsible-001-font);
}
[data-vibeui-block="collapsible-001"] summary{
display:flex;align-items:center;gap:0.625rem;
padding:0.8125rem 0.875rem;cursor:pointer;list-style:none;
border-radius:var(--vibeui-collapsible-001-radius);
font-size:0.875rem;font-weight:650;line-height:1.3;
}
[data-vibeui-block="collapsible-001"] summary::-webkit-details-marker{display:none}
[data-vibeui-block="collapsible-001"] summary:hover{background:color-mix(in oklab,var(--vibeui-collapsible-001-accent) 6%,transparent)}
[data-vibeui-block="collapsible-001"] summary:focus-visible{outline:2px solid var(--vibeui-collapsible-001-accent);outline-offset:-2px}
[data-vibeui-block="collapsible-001"] [data-part="hint"]{
margin-left:auto;font-size:0.75rem;font-weight:500;color:var(--vibeui-collapsible-001-muted);
}
/* Значок — две грани квадрата: поворот честнее подмены символа. */
[data-vibeui-block="collapsible-001"] [data-part="mark"]{
flex:none;width:0.4375rem;height:0.4375rem;
border-right:2px solid var(--vibeui-collapsible-001-muted);
border-bottom:2px solid var(--vibeui-collapsible-001-muted);
transform:rotate(-45deg);transform-origin:60% 60%;
transition:transform .18s ease;
}
[data-vibeui-block="collapsible-001"] [data-part="mark"]:only-child{margin-left:auto}
[data-vibeui-block="collapsible-001"][open] [data-part="mark"]{transform:rotate(45deg)}
[data-vibeui-block="collapsible-001"] [data-part="body"]{
margin:0;padding:0 0.875rem 0.875rem;
border-top:1px solid var(--vibeui-collapsible-001-border);
padding-top:0.75rem;
font-size:0.8125rem;line-height:1.55;color:var(--vibeui-collapsible-001-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="collapsible-001"] *{animation:none!important;transition:none!important}}
`

/**
 * Базовая свёртка на нативном details: состояние в разметке, клиентского
 * кода нет. Один файл, ноль зависимостей, собственная палитра.
 */
export function Collapsible001({
  title = "Как устанавливается компонент",
  hint = "30 секунд",
  text = "Скопируйте команду из карточки, выполните её в корне проекта — файл ляжет в components/vibeui и сразу заработает: внешних зависимостей у него нет.",
  accent,
  className,
  style,
  ...props
}: Collapsible001Props) {
  const palette = {
    ...(accent ? { "--vibeui-collapsible-001-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-collapsible-001" precedence="medium">
        {STYLES}
      </style>
      <details
        {...props}
        data-vibeui-block="collapsible-001"
        className={className}
        style={palette}
      >
        <summary>
          {title}
          {hint ? <span data-part="hint">{hint}</span> : null}
          <span data-part="mark" aria-hidden="true" />
        </summary>
        <p data-part="body">{text}</p>
      </details>
    </>
  )
}