{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "collapsible",
  "type": "registry:ui",
  "title": "Collapsible",
  "description": "A single show/hide disclosure built on native <details>/<summary> — click, Space, or Enter toggle and the browser mirrors aria-expanded, all with zero JavaScript. A standalone disclosure, distinct from the grouped Accordion.",
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/ui/collapsible.tsx",
      "type": "registry:ui",
      "target": "components/ui/collapsible.tsx",
      "content": "/** @jsxImportSource hono/jsx */\nimport type { PropsWithChildren } from \"hono/jsx\"\nimport { cn, type ClassValue } from \"@/registry/lib/cn\"\n\n// Collapsible — shadcn-htmx, htmx v4 + Tailwind v4.\n//\n// shadcn upstream uses Radix Collapsible (a CollapsibleTrigger button + a\n// CollapsibleContent region wired together with aria-expanded / aria-controls\n// and JS state). We use the native HTML disclosure widget instead:\n//   <details><summary>Trigger</summary>...content...</details>\n// so the platform gives us, with zero JS:\n//   - Click / Space / Enter toggles open (browser default on <summary>).\n//   - <summary> is implicitly role=\"button\", focusable, with its text as the\n//     accessible name; the browser sets aria-expanded to mirror `open`.\n//   - The content is the accessible description of the summary.\n//\n// This is the WAI-ARIA Disclosure (Show/Hide) pattern: a single button that\n// shows/hides one section of content. Distinct from Accordion — Collapsible\n// is a standalone, single show/hide, NOT a group, so there is no `name`\n// attribute and no exclusive grouping. No public/site.js hook is required:\n// the entire keyboard contract (Enter / Space) is native to <summary>.\n//\n// Refs:\n//   repos/aria-practices/content/patterns/disclosure/disclosure-pattern.html\n//     (Keyboard: Enter / Space toggle; role=button; aria-expanded true/false)\n//   repos/mdn/files/en-us/web/html/reference/elements/details/index.md\n//     (`open` boolean; implicit ARIA role=group; toggle event)\n//   repos/mdn/files/en-us/web/html/reference/elements/summary/index.md\n//     (click/Space toggles parent <details>; display:list-item marker)\n\ntype CollapsibleProps = PropsWithChildren<{\n  // Pre-open the disclosure on initial render.\n  open?: boolean\n  disabled?: boolean\n  class?: ClassValue\n}>\n\nexport function Collapsible(props: CollapsibleProps) {\n  const { open, disabled, class: className, children, ...rest } = props\n  return (\n    <details\n      data-slot=\"collapsible\"\n      data-disabled={disabled ? \"true\" : undefined}\n      open={open}\n      class={cn(\n        \"w-full\",\n        disabled && \"pointer-events-none opacity-50\",\n        className,\n      )}\n      {...rest}\n    >\n      {children}\n    </details>\n  )\n}\n\ntype CollapsibleTriggerProps = PropsWithChildren<{ class?: ClassValue }>\n\nexport function CollapsibleTrigger(props: CollapsibleTriggerProps) {\n  const { class: className, children, ...rest } = props\n  return (\n    <summary\n      data-slot=\"collapsible-trigger\"\n      class={cn(\n        \"flex cursor-pointer items-center justify-between gap-4 rounded-md py-2 text-left text-sm font-medium transition-all outline-none select-none marker:hidden \" +\n          \"hover:underline \" +\n          \"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 \" +\n          \"list-none [&::-webkit-details-marker]:hidden \" +\n          // Rotate the chevron when the parent <details> is open.\n          \"[details[open]>&_[data-slot=collapsible-chevron]]:rotate-180\",\n        className,\n      )}\n      {...rest}\n    >\n      {children}\n      <svg\n        xmlns=\"http://www.w3.org/2000/svg\"\n        viewBox=\"0 0 24 24\"\n        fill=\"none\"\n        stroke=\"currentColor\"\n        stroke-width=\"2\"\n        stroke-linecap=\"round\"\n        stroke-linejoin=\"round\"\n        data-slot=\"collapsible-chevron\"\n        class=\"pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200\"\n        aria-hidden=\"true\"\n      >\n        <polyline points=\"6 9 12 15 18 9\" />\n      </svg>\n    </summary>\n  )\n}\n\ntype CollapsibleContentProps = PropsWithChildren<{ class?: ClassValue }>\n\nexport function CollapsibleContent(props: CollapsibleContentProps) {\n  const { class: className, children, ...rest } = props\n  return (\n    <div\n      data-slot=\"collapsible-content\"\n      class={cn(\"overflow-hidden pt-2 pb-1 text-sm\", className)}\n      {...rest}\n    >\n      {children}\n    </div>\n  )\n}\n"
    },
    {
      "path": "registry/jinja2/collapsible.html",
      "type": "registry:file",
      "target": "templates/components/collapsible.html",
      "content": "{# Collapsible macros — shadcn-htmx, htmx v4 + Tailwind v4.\n   Mirrors registry/ui/collapsible.tsx. Native <details>/<summary> single\n   disclosure (WAI-ARIA Disclosure pattern). Enter/Space toggle and\n   aria-expanded are all native to <summary> — zero JS.\n\n   Distinct from accordion: a standalone show/hide, no group `name`.\n\n   Usage:\n     {% from \"components/collapsible.html\" import collapsible_open, collapsible_close,\n        collapsible_trigger, collapsible_content_open, collapsible_content_close %}\n\n     {{ collapsible_open(open=true) }}\n       {{ collapsible_trigger(\"Can I use this without JS?\") }}\n       {{ collapsible_content_open() }}\n         Yes — it is native <details>/<summary>.\n       {{ collapsible_content_close() }}\n     {{ collapsible_close() }} #}\n\n{% macro collapsible_open(open=false, disabled=false, extra_class=\"\", attrs={}) -%}\n<details data-slot=\"collapsible\"\n         {%- if disabled %} data-disabled=\"true\"{% endif %}\n         {%- if open %} open{% endif %}\n         class=\"w-full {% if disabled %}pointer-events-none opacity-50{% endif %} {{ extra_class }}\"\n         {%- for k, v in attrs.items() %} {{ k|replace('_','-') }}=\"{{ v }}\"{% endfor %}>\n{%- endmacro %}\n\n{% macro collapsible_close() %}</details>{% endmacro %}\n\n{% macro collapsible_trigger(text, extra_class=\"\") -%}\n<summary data-slot=\"collapsible-trigger\"\n  class=\"flex cursor-pointer items-center justify-between gap-4 rounded-md py-2 text-left text-sm font-medium transition-all outline-none select-none marker:hidden hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 list-none [&::-webkit-details-marker]:hidden [details[open]>&_[data-slot=collapsible-chevron]]:rotate-180 {{ extra_class }}\">\n  {{ text }}\n  <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n       data-slot=\"collapsible-chevron\"\n       class=\"pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200\" aria-hidden=\"true\">\n    <polyline points=\"6 9 12 15 18 9\" />\n  </svg>\n</summary>\n{%- endmacro %}\n\n{% macro collapsible_content_open(extra_class=\"\") -%}\n<div data-slot=\"collapsible-content\" class=\"overflow-hidden pt-2 pb-1 text-sm {{ extra_class }}\">\n{%- endmacro %}\n\n{% macro collapsible_content_close() %}</div>{% endmacro %}\n"
    },
    {
      "path": "registry/go-templates/collapsible.tmpl",
      "type": "registry:file",
      "target": "components/collapsible.tmpl",
      "content": "{{/*\n  Collapsible templates — shadcn-htmx, htmx v4 + Tailwind v4.\n  Mirrors registry/ui/collapsible.tsx. Native <details>/<summary> single\n  disclosure (WAI-ARIA Disclosure pattern). Enter/Space toggle and\n  aria-expanded are native to <summary> — zero JS. No group `name`.\n\n  Two named templates compose:\n    - \"collapsible\"          — full <details> with trigger + content\n    - \"collapsible_trigger\"  — just the <summary> (when composing manually)\n\n  Usage:\n    {{template \"collapsible\" (dict\n      \"Title\" \"Can I use this without JS?\" \"Open\" true\n      \"Body\" (htmlSafe \"Yes — it is native <details>/<summary>.\")\n    )}}\n*/}}\n\n{{/* .Attrs (htmlSafe) forwards hx-* / global attributes onto the <details>\n     so the native `toggle` event it fires can drive zero-JS lazy loading:\n     hx-trigger=\"toggle once\" hx-get=...  (toggle event: HTMLElement;\n     hx-trigger accepts any DOM event). */}}\n{{define \"collapsible\"}}\n<details data-slot=\"collapsible\"\n         {{if .Disabled}}data-disabled=\"true\"{{end}}\n         {{if .Open}}open{{end}}\n         class=\"w-full{{if .Disabled}} pointer-events-none opacity-50{{end}}\"{{with .Attrs}} {{.}}{{end}}>\n  {{template \"collapsible_trigger\" (dict \"Text\" .Title)}}\n  <div data-slot=\"collapsible-content\" class=\"overflow-hidden pt-2 pb-1 text-sm\">{{.Body}}</div>\n</details>\n{{end}}\n\n{{define \"collapsible_trigger\"}}\n<summary data-slot=\"collapsible-trigger\"\n  class=\"flex cursor-pointer items-center justify-between gap-4 rounded-md py-2 text-left text-sm font-medium transition-all outline-none select-none marker:hidden hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 list-none [&::-webkit-details-marker]:hidden [details[open]>&_[data-slot=collapsible-chevron]]:rotate-180\">\n  {{.Text}}\n  <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n       data-slot=\"collapsible-chevron\"\n       class=\"pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200\" aria-hidden=\"true\">\n    <polyline points=\"6 9 12 15 18 9\" />\n  </svg>\n</summary>\n{{end}}\n"
    },
    {
      "path": "registry/phoenix/collapsible.ex",
      "type": "registry:file",
      "target": "lib/my_app_web/components/collapsible.ex",
      "content": "defmodule ShadcnHtmx.Components.Collapsible do\n  @moduledoc \"\"\"\n  Collapsible — shadcn-htmx, htmx v4 + Tailwind v4 for Phoenix.\n\n  Native `<details>` + `<summary>` single disclosure (WAI-ARIA Disclosure\n  pattern). Enter/Space toggle, focusable summary, and the browser-managed\n  aria-expanded are all native — zero JS.\n\n  Distinct from accordion: a standalone show/hide, not a group, so there is\n  no `name` attribute and no exclusive grouping.\n\n  ## Examples\n\n      <.collapsible open>\n        <.collapsible_trigger>Can I use this without JS?</.collapsible_trigger>\n        <.collapsible_content>Yes — it is native &lt;details&gt;/&lt;summary&gt;.</.collapsible_content>\n      </.collapsible>\n  \"\"\"\n\n  use Phoenix.Component\n\n  attr :open, :boolean, default: false\n  attr :disabled, :boolean, default: false\n  attr :class, :string, default: nil\n  attr :rest, :global\n  slot :inner_block, required: true\n\n  def collapsible(assigns) do\n    ~H\"\"\"\n    <details\n      data-slot=\"collapsible\"\n      data-disabled={@disabled && \"true\"}\n      open={@open}\n      class={[\n        \"w-full\",\n        @disabled && \"pointer-events-none opacity-50\",\n        @class\n      ]}\n      {@rest}\n    >\n      {render_slot(@inner_block)}\n    </details>\n    \"\"\"\n  end\n\n  attr :class, :string, default: nil\n  attr :rest, :global\n  slot :inner_block, required: true\n\n  def collapsible_trigger(assigns) do\n    ~H\"\"\"\n    <summary\n      data-slot=\"collapsible-trigger\"\n      class={[\n        \"flex cursor-pointer items-center justify-between gap-4 rounded-md py-2 text-left text-sm font-medium\",\n        \"transition-all outline-none select-none marker:hidden hover:underline\",\n        \"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50\",\n        \"list-none [&::-webkit-details-marker]:hidden\",\n        \"[details[open]>&_[data-slot=collapsible-chevron]]:rotate-180\",\n        @class\n      ]}\n      {@rest}\n    >\n      {render_slot(@inner_block)}\n      <svg\n        xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\"\n        stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n        data-slot=\"collapsible-chevron\"\n        class=\"pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200\"\n        aria-hidden=\"true\"\n      >\n        <polyline points=\"6 9 12 15 18 9\" />\n      </svg>\n    </summary>\n    \"\"\"\n  end\n\n  attr :class, :string, default: nil\n  attr :rest, :global\n  slot :inner_block, required: true\n\n  def collapsible_content(assigns) do\n    ~H\"\"\"\n    <div data-slot=\"collapsible-content\" class={[\"overflow-hidden pt-2 pb-1 text-sm\", @class]} {@rest}>\n      {render_slot(@inner_block)}\n    </div>\n    \"\"\"\n  end\nend\n"
    },
    {
      "path": "registry/html/collapsible.html",
      "type": "registry:file",
      "target": "snippets/collapsible.html",
      "content": "<!--\n  shadcn-htmx — raw HTML collapsible snippet.\n\n  Native <details> + <summary> single disclosure (WAI-ARIA Disclosure\n  pattern). Click / Space / Enter toggle open, the summary is focusable and\n  implicitly role=\"button\", and the browser mirrors aria-expanded — all with\n  zero JavaScript. Distinct from accordion: a single standalone show/hide,\n  with no `name` group attribute.\n\n  Relies only on the theme tokens in styles.css.\n-->\n\n<details data-slot=\"collapsible\" open class=\"w-full\">\n  <summary data-slot=\"collapsible-trigger\"\n    class=\"flex cursor-pointer items-center justify-between gap-4 rounded-md py-2 text-left text-sm font-medium transition-all outline-none select-none marker:hidden hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 list-none [&::-webkit-details-marker]:hidden [details[open]>&_[data-slot=collapsible-chevron]]:rotate-180\">\n    Can I use this without JavaScript?\n    <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\n         data-slot=\"collapsible-chevron\" class=\"pointer-events-none size-4 shrink-0 text-muted-foreground transition-transform duration-200\" aria-hidden=\"true\">\n      <polyline points=\"6 9 12 15 18 9\" />\n    </svg>\n  </summary>\n  <div data-slot=\"collapsible-content\" class=\"overflow-hidden pt-2 pb-1 text-sm\">\n    Yes. The open/close toggle, keyboard handling (Space / Enter), focus, and\n    aria-expanded are all native to &lt;details&gt;/&lt;summary&gt;.\n  </div>\n</details>\n"
    }
  ]
}
