# Collapsible panel

A controlled or uncontrolled native disclosure panel with consumer-owned nested content and composed trigger behavior.

Access: pro. Category: Essentials. Kind: composite.

## When to use

- Use it when a page needs a controlled or uncontrolled native disclosure panel with consumer-owned nested content and composed trigger behavior.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose tidal-button instead when press, loading, success and disabled states is the actual interface need, rather than collapsible panel.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Collapsible panel

```sh
npx shadcn@latest add @tidal-pro/collapsible-panel
```

Stylesheets: `components/ui/tidal.css`, `components/ui/collapsible-panel.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/collapsible-panel.css";
import{TidalCollapsiblePanel}from"./components/ui/collapsible-panel";
export default()=><div className="tidal-scope"><TidalCollapsiblePanel children={"value"} title={"Demo"}/></div>;
```

## Structured props

- `TidalCollapsiblePanel.children: ReactNode`: Required children value accepted by this exported component.
- `TidalCollapsiblePanel.title: ReactNode`: Required title value accepted by this exported component.
- `TidalCollapsiblePanel.contentProps?: Omit<HTMLAttributes<HTMLDivElement>, "id" | "children"> | undefined`: Optional content props value accepted by this exported component.
- `TidalCollapsiblePanel.contentRef?: Ref<HTMLDivElement> | undefined`: Optional content ref value accepted by this exported component.
- `TidalCollapsiblePanel.defaultOpen?: boolean | undefined` (default false): Optional default open value accepted by this exported component.
- `TidalCollapsiblePanel.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalCollapsiblePanel.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalCollapsiblePanel.eyebrow?: ReactNode`: Optional eyebrow value accepted by this exported component.
- `TidalCollapsiblePanel.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalCollapsiblePanel.leadingVisual?: ReactNode`: Optional leading visual value accepted by this exported component.
- `TidalCollapsiblePanel.meta?: ReactNode`: Optional meta value accepted by this exported component.
- `TidalCollapsiblePanel.onOpenChange?: ((open: boolean, event: ReactMouseEvent<HTMLElement>) => void) | undefined`: Callback invoked when the open change interaction is proposed.
- `TidalCollapsiblePanel.onToggle?: ToggleEventHandler<HTMLDetailsElement> | undefined`: Callback invoked when the toggle interaction is proposed.
- `TidalCollapsiblePanel.open?: boolean | undefined`: Optional open value accepted by this exported component.
- `TidalCollapsiblePanel.triggerProps?: Omit<HTMLAttributes<HTMLElement>, "role" | "aria-controls" | "aria-disabled" | "aria-expanded" | "children"> | undefined`: Optional trigger props value accepted by this exported component.
- `TidalCollapsiblePanel.triggerRef?: Ref<HTMLElement> | undefined`: Optional trigger ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/collapsible-panel.tsx) | [Manifest](https://tidalui.com/examples/collapsible-panel.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useMemo, useState } from "react";

import { TidalCollapsiblePanel } from "./components/ui/collapsible-panel";

import "./components/ui/collapsible-panel.css";



const tidalExampleStyles = ".tidal-scope .collapsible-panel-demo,\n.tidal-scope .collapsible-panel-demo * {\n  box-sizing: border-box;\n}\n\n.tidal-scope .collapsible-panel-demo {\n  width: 100%;\n  min-width: 0;\n  border: 1px solid var(--t-border);\n  border-radius: 22px;\n  background:\n    linear-gradient(var(--t-border) 1px, transparent 1px) 0 0 / 30px 30px,\n    linear-gradient(90deg, var(--t-border) 1px, transparent 1px) 0 0 / 30px 30px,\n    var(--t-subtle);\n  color: var(--t-ink);\n  container: collapsible-demo / inline-size;\n}\n\n.tidal-scope .collapsible-panel-demo-frame {\n  display: grid;\n  min-width: 0;\n  grid-template-columns: minmax(190px, 0.44fr) minmax(0, 1fr);\n  align-items: center;\n  gap: 24px;\n  padding: 28px;\n}\n\n.tidal-scope .collapsible-panel-demo-content {\n  min-width: 0;\n}\n\n.tidal-scope .collapsible-panel-demo-summary {\n  display: grid;\n  min-width: 0;\n  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.65fr);\n  align-items: center;\n  gap: 18px;\n  padding-bottom: 18px;\n  border-bottom: 1px solid var(--t-border);\n}\n\n.tidal-scope .collapsible-panel-demo-summary > div:first-child {\n  display: flex;\n  min-width: 0;\n  align-items: baseline;\n  justify-content: space-between;\n  gap: 12px;\n}\n\n.tidal-scope .collapsible-panel-demo-summary > div:first-child > span {\n  min-width: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  font-weight: 650;\n  line-height: 1.4;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .collapsible-panel-demo-summary strong {\n  flex: none;\n  font-size: 22px;\n  font-variant-numeric: tabular-nums;\n  font-weight: 560;\n  letter-spacing: -0.045em;\n}\n\n.tidal-scope .collapsible-panel-demo-summary > div:last-child {\n  height: 7px;\n  overflow: hidden;\n  border-radius: 99px;\n  background: var(--t-wash);\n}\n\n.tidal-scope .collapsible-panel-demo-summary > div:last-child > span {\n  display: block;\n  height: 100%;\n  border-radius: inherit;\n  background: var(--t-ink);\n  transition: width 420ms var(--t-ease-out);\n}\n\n.tidal-scope .collapsible-panel-demo fieldset {\n  display: grid;\n  min-width: 0;\n  gap: 7px;\n  margin: 17px 0 0;\n  padding: 0;\n  border: 0;\n}\n\n.tidal-scope .collapsible-panel-demo legend {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n\n.tidal-scope .collapsible-panel-demo fieldset label {\n  display: grid;\n  min-width: 0;\n  min-height: 48px;\n  grid-template-columns: 44px minmax(0, 1fr);\n  align-items: center;\n  gap: 10px;\n  padding: 2px 12px 2px 2px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-surface);\n  cursor: pointer;\n  transition:\n    border-color 180ms,\n    background 180ms;\n}\n\n.tidal-scope .collapsible-panel-demo fieldset input {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  opacity: 0;\n}\n\n.tidal-scope .collapsible-panel-demo fieldset label > span {\n  display: grid;\n  width: 44px;\n  height: 44px;\n  place-items: center;\n  border: 1px solid var(--t-border);\n  border-radius: 8px;\n  background: var(--t-subtle);\n  transition:\n    background 220ms,\n    border-color 220ms,\n    transform 280ms var(--t-ease-spring);\n}\n\n.tidal-scope .collapsible-panel-demo fieldset label > span::after {\n  width: 12px;\n  height: 6px;\n  border-block-end: 2px solid currentColor;\n  border-inline-start: 2px solid currentColor;\n  content: \"\";\n  opacity: 0;\n  transform: rotate(-45deg) scale(0.6);\n  transition:\n    opacity 180ms,\n    transform 280ms var(--t-ease-spring);\n}\n\n.tidal-scope .collapsible-panel-demo fieldset label[data-complete=\"true\"] {\n  border-color: var(--t-ink);\n}\n\n.tidal-scope\n  .collapsible-panel-demo\n  fieldset\n  label[data-complete=\"true\"]\n  > span {\n  border-color: var(--t-ink);\n  background: var(--t-ink);\n  color: var(--t-surface);\n}\n\n.tidal-scope\n  .collapsible-panel-demo\n  fieldset\n  label[data-complete=\"true\"]\n  > span::after {\n  opacity: 1;\n  transform: rotate(-45deg) scale(1);\n}\n\n.tidal-scope .collapsible-panel-demo fieldset label > strong {\n  min-width: 0;\n  font-size: 11px;\n  font-weight: 640;\n  line-height: 1.4;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .collapsible-panel-demo fieldset input:focus-visible + span {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n@container collapsible-demo (max-width: 720px) {\n  .tidal-scope .collapsible-panel-demo-frame {\n    grid-template-columns: minmax(0, 1fr);\n    gap: 18px;\n    padding: 16px;\n  }\n}\n\n@container collapsible-demo (max-width: 390px) {\n  .tidal-scope .collapsible-panel-demo-frame {\n    gap: 13px;\n    padding: 7px;\n  }\n\n  .tidal-scope .collapsible-panel-demo-summary {\n    grid-template-columns: minmax(0, 1fr);\n    gap: 10px;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .collapsible-panel-demo-summary > div:last-child > span,\n  .tidal-scope .collapsible-panel-demo fieldset label,\n  .tidal-scope .collapsible-panel-demo fieldset label > span,\n  .tidal-scope .collapsible-panel-demo fieldset label > span::after {\n    transition: none;\n  }\n}";

const INITIAL_CHECKS = {
  brief: true,
  assets: true,
  copy: false,
} as const;

export function CollapsiblePanelDemo() {
  const [open, setOpen] = useState(true);
  const [checks, setChecks] =
    useState<Record<keyof typeof INITIAL_CHECKS, boolean>>(INITIAL_CHECKS);
  const [message, setMessage] = useState("Two of three checks are complete.");
  const complete = useMemo(
    () => Object.values(checks).filter(Boolean).length,
    [checks],
  );

  const toggleCheck = (key: keyof typeof INITIAL_CHECKS, label: string) => {
    const next = { ...checks, [key]: !checks[key] };
    const count = Object.values(next).filter(Boolean).length;
    setChecks(next);
    setMessage(
      `${label} marked ${next[key] ? "complete" : "incomplete"}. ${count} of 3 checks are complete.`,
    );
  };

  return (
    <section
      className="collapsible-panel-demo"
      aria-label="Launch review preview"
    >
      <div className="collapsible-panel-demo-frame">
        <TidalCollapsiblePanel
          title="Release checklist"
          description="Check the details before launch."
          meta={`${complete} / 3`}
          triggerProps={{ "aria-label": "Toggle release checklist" }}
          open={open}
          onOpenChange={(nextOpen) => {
            setOpen(nextOpen);
            setMessage(
              `The release checklist is ${nextOpen ? "expanded" : "collapsed"}.`,
            );
          }}
          leadingVisual={
            <svg viewBox="0 0 24 24">
              <path
                d="M6 4.75h9.5L19 8.3v10.95H6z"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.6"
                strokeLinejoin="round"
              />
              <path
                d="M15.5 4.75V8.3H19M9 12h7M9 15.5h5"
                fill="none"
                stroke="currentColor"
                strokeWidth="1.6"
                strokeLinecap="round"
              />
            </svg>
          }
          footer={
            <span role="status" aria-live="polite">
              {message} Sample data. Changes stay in this preview.
            </span>
          }
        >
          <div className="collapsible-panel-demo-content">
            <div className="collapsible-panel-demo-summary">
              <div>
                <span>Readiness</span>
                <strong>{Math.round((complete / 3) * 100)}%</strong>
              </div>
              <div aria-label={`${complete} of 3 checks complete`} role="img">
                <span style={{ width: `${(complete / 3) * 100}%` }} />
              </div>
            </div>
            <fieldset>
              <legend>Launch checks</legend>
              <label data-complete={checks.brief || undefined}>
                <input
                  type="checkbox"
                  checked={checks.brief}
                  onChange={() => toggleCheck("brief", "Project brief")}
                />
                <span aria-hidden="true" />
                <strong>Project brief reviewed</strong>
              </label>
              <label data-complete={checks.assets || undefined}>
                <input
                  type="checkbox"
                  checked={checks.assets}
                  onChange={() => toggleCheck("assets", "Assets")}
                />
                <span aria-hidden="true" />
                <strong>Assets named</strong>
              </label>
              <label data-complete={checks.copy || undefined}>
                <input
                  type="checkbox"
                  checked={checks.copy}
                  onChange={() => toggleCheck("copy", "Launch copy")}
                />
                <span aria-hidden="true" />
                <strong>Launch copy approved</strong>
              </label>
            </fieldset>
          </div>
        </TidalCollapsiblePanel>
      </div>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <CollapsiblePanelDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

title and children are required. The native details root supports controlled open/onOpenChange or uncontrolled defaultOpen state; controlled open without onOpenChange is intentionally read-only. Optional disabled blocks the summary trigger. Native summary clicks run before state changes and may prevent them; native keyboard activation produces the same click path. Optional description, eyebrow, meta, leadingVisual and footer accept ReactNode values. Native details/summary/content attributes and refs pass through while open, role and disclosure ARIA remain component-owned. The native onToggle callback observes actual details state changes. Nested consumer content stays consumer-owned. The component performs no request, routing, analytics, network, storage or persistence work.
