BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ui-layouts/accordion

accordion

ui-layouts/accordion
FreeComponent

ui-layouts publishes no description for this item.

Install it

npx shadcn@latest add https://www.ui-layouts.com/r/accordion.json

Source

./components/ui/accordion.tsxwww.ui-layouts.com/r/accordion.json · first 6 KB
1'use client';
2
3import { cn } from '@/lib/utils';
4import { ChevronDown } from 'lucide-react';
5import { AnimatePresence, motion } from 'motion/react';
6import React, { type ReactNode, useCallback } from 'react';
7
8/**
9 * Interface for AccordionContext values
10 */
11interface AccordionContextType {
12 /**
13 * Whether the accordion item is active
14 */
15 isActive?: boolean;
16 /**
17 * The value of the accordion item
18 */
19 value?: string;
20 /**
21 * Function to change the active index
22 */
23 onChangeIndex?: (value: string) => void;
24}
25
26/**
27 * Context for accordion components
28 */
29const AccordionContext = React.createContext<AccordionContextType>({});
30/**
31 * Hook to use the accordion context
32 */
33const useAccordion = () => React.useContext(AccordionContext);
34
35/**
36 * Container component for accordion items
37 */
38export function AccordionContainer({
39 children,
40 className,
41}: {
42 children: ReactNode;
43 className?: string;
44}) {
45 return <div className={cn('grid grid-cols-2 gap-1', className)}>{children}</div>;
46}
47
48/**
49 * Wrapper component for accordion items
50 */
51export function AccordionWrapper({ children }: { children: ReactNode }) {
52 return <div>{children}</div>;
53}
54
55/**
56 * Interface for Accordion props
57 */
58interface AccordionProps {
59 /**
60 * Children components
61 */
62 children: ReactNode;
63 /**
64 * Whether multiple items can be active at the same time
65 */
66 multiple?: boolean;
67 /**
68 * Default active index
69 */
70 defaultValue?: string | string[];
71}
72
73/**
74 * Accordion component
75 */
76export function Accordion({ children, multiple, defaultValue }: AccordionProps) {
77 /**
78 * State for active index
79 */
80 const [activeIndex, setActiveIndex] = React.useState<string | string[] | null>(
81 multiple ? (Array.isArray(defaultValue) ? defaultValue : []) : defaultValue || null
82 );
83
84 /**
85 * Function to change the active index
86 */
87 const onChangeIndex = useCallback(
88 (value: string) => {
89 setActiveIndex((currentActiveIndex) => {
90 if (!multiple) {
91 return value === currentActiveIndex ? null : value;
92 }
93
94 if (Array.isArray(currentActiveIndex)) {
95 if (currentActiveIndex.includes(value)) {
96 return currentActiveIndex.filter((i) => i !== value);
97 }
98 return [...currentActiveIndex, value];
99 }
100
101 return [value];
102 });
103 },
104 [multiple]
105 );
106
107 return React.Children.map(children, (child) => {
108 if (!React.isValidElement(child)) return null;
109
110// … truncated

Files it writes

  • ./components/ui/accordion.tsx

Facts

Registry
ui-layouts
Type
registry:component
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

www.ui-layouts.com ui-layouts/mdx-starter-repo on GitHub Raw registry item This item as JSON

More from ui-layouts

All 1 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
3d-marquee3d-marqueeui-layoutsComponentsFreeno deps · 2 files
align-slideralign-sliderui-layoutsComponentsFree6 deps · 2 files
animal-imagemaskinganimal-imagemaskingui-layoutsComponentsFree1 dep
animated-beamanimated-beamui-layoutsComponentsFreeno deps
animated-beam-bidirectionalanimated-beam-bidirectionalui-layoutsComponentsFreeno deps
animated-beam-defaultanimated-beam-defaultui-layoutsComponentsFreeno deps
animated-beam-multiple-inputanimated-beam-multiple-inputui-layoutsComponentsFreeno deps
animated-beam-multiple-outputanimated-beam-multiple-outputui-layoutsComponentsFreeno 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