BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn-htmx/exclusive-accordion

Exclusive Accordion

shadcn-htmx/exclusive-accordion
FreeComponent

Scriptless single-open accordion: multiple native <details> elements share one `name` attribute so opening one auto-closes the others — the pure-HTML exclusive variant of the APG-scripted accordion. Zero JavaScript; the exclusivity survives with JS disabled. Ships in five flavours: Hono JSX (TypeScript), Jinja2 macros, Go html/template, Phoenix function component, and a raw HTML snippet.

Live preview

live · rendered by the registry
Rendered by shadcn-htmx on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://shadcn-htmx.productdevbook.com/r/exclusive-accordion.json

Source

registry/ui/exclusive-accordion.tsxshadcn-htmx.productdevbook.com/r/exclusive-accordion.json
1/** @jsxImportSource hono/jsx */
2import type { PropsWithChildren } from "hono/jsx"
3import { cn, type ClassValue } from "@/registry/lib/cn"
4
5// Exclusive Accordion — shadcn-htmx, htmx v4 + Tailwind v4.
6//
7// The scriptless, single-open accordion. Several <details> elements share one
8// `name` attribute, so the browser keeps exactly one open at a time: opening
9// any item auto-closes the others. This is the pure-HTML exclusive variant of
10// the APG-scripted accordion — ZERO JavaScript, no boot script, no site.js.
11//
12// shadcn upstream uses Radix Accordion (a JS state machine wiring buttons +
13// regions with aria-expanded / aria-controls). We let the platform do it:
14// - Click / Space / Enter toggles open (browser default on <summary>).
15// - <summary> is implicitly role="button", focusable, with its text as the
16// accessible name; the browser sets aria-expanded to mirror `open`.
17// - <details name="..."> makes the group mutually exclusive natively. Per the
18// HTML spec, if more than one grouped item carries `open`, only the FIRST
19// in source order renders open — so we never produce an invalid state.
20//
21// This component differs from registry/ui/accordion.tsx (type="single"), which
22// assigns the grouping `name` at runtime via public/site.js and layers the APG
23// arrow-key contract on top. ExclusiveAccordion renders the `name` straight
24// into the server HTML, so the exclusivity survives with JS disabled and there
25// is no keyboard contract beyond what <summary> ships natively (Tab to focus,
26// Enter / Space to toggle). That makes it the right pick for progressive-
27// enhancement-first surfaces (docs FAQs, server-rendered settings panels).
28//
29// Refs:
30// repos/mdn/files/en-us/web/html/reference/elements/details/index.md
31// (`name` attribute — "give multiple <details> the same name value to
32// group them. Only one of the grouped <details> can be open at a time …
33// if multiple are given `open`, only the first in source order renders
34// open." Also: `open` boolean, the `toggle` event, implicit role=group.)
35// repos/mdn/files/en-us/web/html/reference/elements/summary/index.md
36// (click / Space toggles parent <details>; display:list-item marker.)
37// repos/aria-practices/content/patterns/accordion/ (the scripted contract we
38// deliberately do NOT emulate here — see the note above.)
39// repos/aria-practices/content/patterns/disclosure/ (native <details> is a
40// … truncated

Facts

Registry
shadcn-htmx
Type
registry:ui
Access
Free
Files written
0
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on shadcn-htmx shadcn-htmx.productdevbook.com productdevbook/shadcn-htmx on GitHub Raw registry item This item as JSON

More from shadcn-htmx

All 83 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionshadcn-htmxComponentsFreeno deps
Active Searchactive-searchshadcn-htmxComponentsFreeno deps
Alertalertshadcn-htmxComponentsFreeno deps
Alert Dialogalert-dialogshadcn-htmxComponentsFreeno deps
Aspect Ratioaspect-ratioshadcn-htmxComponentsFreeno deps
Auto Gridauto-gridshadcn-htmxComponentsFreeno deps
Autocompleteautocompleteshadcn-htmxComponentsFreeno deps
Autosize Textareaautosize-textareashadcn-htmxComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex