{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible",
  "type": "registry:component",
  "title": "Collapsible",
  "description": "Shows or hides one section with a native details disclosure.",
  "registryDependencies": [
    "https://vlak.dev/r/vlak-base.json",
    "https://vlak.dev/r/inter.json",
    "https://vlak.dev/r/accordion.json",
    "https://vlak.dev/r/vlak-lib.json",
    "https://vlak.dev/r/icons.json"
  ],
  "dependencies": [
    "@stylexjs/stylex"
  ],
  "devDependencies": [
    "@stylexjs/babel-plugin"
  ],
  "docs": "Vlak leaves are StyleX. Compile them with @stylexjs/babel-plugin (Vite: @stylexjs/unplugin, Next: @stylexjs/nextjs-plugin). If you would rather not run a compiler, import @noorddev/vlak-react instead: it ships precompiled with one stylesheet.",
  "files": [
    {
      "path": "vlak/collapsible.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport * as stylex from \"@stylexjs/stylex\";\nimport { vlak, mq } from \"./tokens.stylex\";\nimport { rs } from \"./rs\";\nimport { Icon } from \"./icons\";\n\nexport interface CollapsibleProps\n  extends Omit<React.DetailsHTMLAttributes<HTMLDetailsElement>, \"title\"> {\n  title: React.ReactNode;\n  defaultOpen?: boolean;\n}\n\nconst styles = stylex.create({\n  summary: {\n    listStyle: \"none\",\n    cursor: \"pointer\",\n    display: \"inline-flex\",\n    alignItems: \"center\",\n    gap: \"0.4375rem\",\n    minHeight: {\n      default: vlak.hit,\n      [mq.phone]: vlak.hit,\n    },\n    minWidth: vlak.hit,\n    fontSize: {\n      default: \"0.84375rem\",\n      [mq.phone]: \"1.0625rem\",\n    },\n    fontWeight: 600,\n    letterSpacing: \"-0.01em\",\n    color: vlak.ink,\n    \"::-webkit-details-marker\": {\n      display: \"none\",\n    },\n    outlineWidth: {\n      default: null,\n      \":focus-visible\": 2,\n    },\n    outlineStyle: {\n      default: null,\n      \":focus-visible\": \"solid\",\n    },\n    outlineColor: {\n      default: null,\n      \":focus-visible\": vlak.ink,\n    },\n    outlineOffset: {\n      default: null,\n      \":focus-visible\": 2,\n    },\n  },\n  chevron: {\n    transition: {\n      default: `transform ${vlak.duration} ${vlak.ease}`,\n      [mq.reduce]: \"none\",\n    },\n  },\n  chevronOpen: {\n    transform: \"rotate(180deg)\",\n  },\n  body: {\n    paddingTop: {\n      default: \"0.625rem\",\n      [mq.phone]: \"0.75rem\",\n    },\n    paddingInlineEnd: 0,\n    paddingBottom: 0,\n    paddingInlineStart: 0,\n    fontSize: {\n      default: \"0.84375rem\",\n      [mq.phone]: \"1rem\",\n    },\n    lineHeight: 1.45,\n    color: vlak.gray,\n  },\n});\n\n/** A bare native <details>. */\nexport const Collapsible = React.forwardRef<HTMLDetailsElement, CollapsibleProps>(function Collapsible({\n  title,\n  defaultOpen,\n  className,\n  style,\n  children,\n  onToggle,\n  open,\n  ...props\n}, ref) {\n  const [innerOpen, setInnerOpen] = React.useState(!!defaultOpen);\n  const isOpen = open ?? innerOpen;\n  const root = rs([\"rs-disclosure\", className]);\n  const summary = rs([\"rs-disclosure-summary\"], styles.summary);\n  const chevron = rs([\"rs-acc-chevron\", \"rs-disclosure-chevron\", isOpen && \"rs-disclosure-chevron-open\"], styles.chevron, isOpen && styles.chevronOpen);\n  const body = rs([\"rs-disclosure-body\"], styles.body);\n  return (\n    <details\n      ref={ref}\n      open={open ?? (defaultOpen || undefined)}\n      onToggle={(e) => {\n        setInnerOpen(e.currentTarget.open);\n        onToggle?.(e);\n      }}\n      {...props}\n      className={root.className}\n      style={{ ...root.style, ...style }}\n    >\n      <summary className={summary.className} style={summary.style}>\n        {title}\n        <Icon name=\"chevron-right\" rotate={90} className={chevron.className} style={chevron.style} />\n      </summary>\n      <div className={body.className} style={body.style}>\n        {children}\n      </div>\n    </details>\n  );\n});\n",
      "type": "registry:component",
      "target": "components/vlak/collapsible.tsx"
    },
    {
      "path": "vlak/styles/collapsible.css",
      "content": "/* ── collapsible: generated from packages/react/src/components/collapsible.tsx ── */\n.rs-disclosure-summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:0.4375rem;min-height:var(--hit);min-width:var(--hit);font-size:0.84375rem;font-weight:600;letter-spacing:-0.01em;color:var(--text)}\n.rs-disclosure-summary::-webkit-details-marker{display:none}\n.rs-disclosure-summary:focus-visible{outline-width:2px;outline-style:solid;outline-color:var(--text);outline-offset:2px}\n@media (max-width: 640px){.rs-disclosure-summary{min-height:var(--hit);font-size:1.0625rem}}\n.rs-acc-chevron.rs-disclosure-chevron{transition:transform var(--duration) var(--ease)}\n@media (prefers-reduced-motion: reduce){.rs-acc-chevron.rs-disclosure-chevron{transition:none}}\n.rs-disclosure-chevron-open{transform:rotate(180deg)}\n.rs-disclosure-body{padding-top:0.625rem;padding-inline-end:0;padding-bottom:0;padding-inline-start:0;font-size:0.84375rem;line-height:1.45;color:var(--text-secondary)}\n@media (max-width: 640px){.rs-disclosure-body{padding-top:0.75rem;font-size:1rem}}\n.rs-disclosure{display:block}\n",
      "type": "registry:file",
      "target": "styles/vlak/collapsible.css"
    }
  ],
  "meta": {
    "vlak": {
      "category": "content",
      "classes": [
        "rs-disclosure",
        "rs-disclosure-body",
        "rs-disclosure-chevron",
        "rs-disclosure-chevron-open",
        "rs-disclosure-summary"
      ],
      "snippet": "<details class=\"rs-disclosure\"><summary>Show the details<svg class=\"rs-acc-chevron\" viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.25\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><g transform=\"rotate(90 8 8)\"><path d=\"M5.5 3.5 L10.5 8 L5.5 12.5\" vector-effect=\"non-scaling-stroke\"/></g></svg></summary><div class=\"rs-disclosure-body\">Here they are.</div></details>",
      "cssOnly": false,
      "registryDependencies": [
        "accordion",
        "vlak-lib",
        "icons"
      ],
      "aliases": [
        "Collapsible",
        "Disclosure",
        "Details",
        "Expander"
      ],
      "example": "import { Collapsible } from \"@noorddev/vlak-react\";\n\n<Collapsible title=\"Show the details\">Here they are.</Collapsible>\n<Collapsible title=\"Advanced\" open={open} onToggle={(e) => setOpen(e.currentTarget.open)}>…</Collapsible>",
      "usage": {
        "use": [
          "One optional block the reader can reveal: details, advanced options, a long list.",
          "defaultOpen when most readers want it open."
        ],
        "avoid": [
          "Several related sections; use Accordion.",
          "Content everyone needs; leave it in the flow."
        ]
      },
      "keyboard": [
        {
          "keys": "Tab",
          "does": "Moves focus to the summary"
        },
        {
          "keys": "Enter, Space",
          "does": "Opens or closes it"
        }
      ],
      "a11y": [
        "A native <details> and <summary>; the platform exposes the expanded state and title is the name."
      ]
    }
  }
}
