BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/optics/accordion

Accordion

optics/accordion
FreeComponent

A vertically stacked set of interactive headings that each reveal a section of content.

See it running

Open the demo on optics

optics.agusmayol.com.ar/components/accordion
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://optics.agusmayol.com.ar/r/accordion.json

Source

registry/optics/accordion.jsxoptics.agusmayol.com.ar/r/accordion.json
1"use client";
2
3import * as React from "react";
4import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
5import { AnimatePresence, motion } from "motion/react";
6import { ChevronDownIcon } from "lucide-react";
7
8import { getStrictContext } from "@/registry/optics/lib/get-strict-context";
9import { useControlledState } from "@/registry/optics/hooks/use-controlled-state";
10import { cn } from "@/registry/optics/lib/utils";
11
12// --- Internal Primitive Logic ---
13
14const [AccordionProvider, useAccordion] = getStrictContext("AccordionContext");
15
16const [AccordionItemProvider, useAccordionItem] = getStrictContext(
17 "AccordionItemContext",
18);
19
20function PrimitiveAccordion({ collapsible = false, ...props } = {}) {
21 const [value, setValue] = useControlledState({
22 value: props?.value,
23 defaultValue: props?.defaultValue,
24 onChange: props?.onValueChange,
25 });
26
27 return (
28 <AccordionProvider value={{ value, setValue }}>
29 <BaseAccordion.Root
30 data-slot="accordion"
31 {...props}
32 onValueChange={setValue}
33 />
34 </AccordionProvider>
35 );
36}
37
38function PrimitiveAccordionItem(props = {}) {
39 const { value } = useAccordion();
40 const [isOpen, setIsOpen] = React.useState(
41 value?.includes(props?.value) ?? false,
42 );
43
44 React.useEffect(() => {
45 setIsOpen(value?.includes(props?.value) ?? false);
46 }, [value, props?.value]);
47
48 return (
49 <AccordionItemProvider value={{ isOpen, setIsOpen }}>
50 <BaseAccordion.Item data-slot="accordion-item" {...props} />
51 </AccordionItemProvider>
52 );
53}
54
55function PrimitiveAccordionHeader(props = {}) {
56 return <BaseAccordion.Header data-slot="accordion-header" {...props} />;
57}
58
59function PrimitiveAccordionTrigger(props = {}) {
60 return <BaseAccordion.Trigger data-slot="accordion-trigger" {...props} />;
61}
62
63function PrimitiveAccordionPanel({
64 transition = { duration: 0.35, ease: "easeInOut" },
65 hiddenUntilFound,
66 keepRendered = false,
67 ...props
68} = {}) {
69 const { isOpen } = useAccordionItem();
70
71 return (
72 <AnimatePresence>
73 {keepRendered ? (
74 <BaseAccordion.Panel
75 hidden={false}
76 hiddenUntilFound={hiddenUntilFound}
77 keepMounted
78 render={
79 <motion.div
80 key="accordion-panel"
81 data-slot="accordion-panel"
82 initial={{ height: 0, opacity: 0, "--mask-stop": "0%", y: 20 }}
83 animate={
84 isOpen
85 ? { height: "auto", opacity: 1, "--mask-stop": "100%", y: 0 }
86 : { height: 0, opacity: 0, "--mask-stop": "0%", y: 20 }
87 }
88 transition={transition}
89 style={{
90// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • lucide-react
  • motion
  • clsx
  • tailwind-merge

Other registry items

  • https://optics.agusmayol.com.ar/r/get-strict-context.json
  • https://optics.agusmayol.com.ar/r/use-controlled-state.json
  • https://optics.agusmayol.com.ar/r/utils.json

Files it writes

  • registry/optics/accordion.jsx

Facts

Registry
optics
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-10
Last confirmed
3 days ago

Go to the source

Docs on optics optics.agusmayol.com.ar AgusMayol/optics on GitHub Raw registry item This item as JSON

More from optics

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AlertalertopticsComponentsFree4 deps
Alert Dialogalert-dialogopticsComponentsFree4 deps
Aspect Ratioaspect-ratioopticsComponentsFree2 deps
Auto Heightauto-heightopticsComponentsFree3 deps
AvataravataropticsComponentsFree3 deps
BadgebadgeopticsComponentsFree4 deps
BreadcrumbbreadcrumbopticsComponentsFree4 deps
ButtonbuttonopticsComponentsFree4 deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex