BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fluid-functionalism/accordion

Accordion

fluid-functionalism/accordion
FreeComponent

Collapsible accordion with animated height transitions, spring-animated chevron, and proximity hover in grouped mode. Built on Radix UI Accordion.

Install it

npx shadcn@latest add https://fluidfunctionalism.com/r/accordion.json

Source

registry/radix/accordion.tsxfluidfunctionalism.com/r/accordion.json · first 6 KB
1"use client";
2
3import {
4 useRef,
5 useState,
6 useEffect,
7 useLayoutEffect,
8 useCallback,
9 useMemo,
10 createContext,
11 useContext,
12 forwardRef,
13 type ReactNode,
14 type HTMLAttributes,
15} from "react";
16import { motion, AnimatePresence } from "framer-motion";
17import * as AccordionPrimitive from "@radix-ui/react-accordion";
18
19// SSR-safe layout effect (client components still server-render in Next).
20const useIsoLayoutEffect =
21 typeof window !== "undefined" ? useLayoutEffect : useEffect;
22import { cn } from "@/lib/utils";
23import { useIcon } from "@/lib/icon-context";
24import { spring } from "@/lib/springs";
25import { fontWeights } from "@/lib/font-weight";
26import { useProximityHover } from "@/hooks/use-proximity-hover";
27import { useShape } from "@/lib/shape-context";
28
29// ─── Contexts ────────────────────────────────────────────────────────────────
30
31interface ItemRect {
32 top: number;
33 left: number;
34 width: number;
35 height: number;
36}
37
38interface AccordionGroupContextValue {
39 registerItem: (index: number, element: HTMLElement | null) => void;
40 registerFullItem: (index: number, element: HTMLElement | null) => void;
41 activeIndex: number | null;
42 grouped: true;
43 remeasure: () => void;
44 openValues: Set<string>;
45 openItemRects: Map<number, ItemRect>;
46}
47
48const AccordionGroupContext =
49 createContext<AccordionGroupContextValue | null>(null);
50
51function useAccordionGroup() {
52 return useContext(AccordionGroupContext);
53}
54
55interface AccordionItemContextValue {
56 index?: number;
57 value: string;
58 isOpen: boolean;
59 triggerRef: React.MutableRefObject<HTMLDivElement | null>;
60}
61
62const AccordionItemContext =
63 createContext<AccordionItemContextValue | null>(null);
64
65function useAccordionItemContext() {
66 const ctx = useContext(AccordionItemContext);
67 if (!ctx)
68 throw new Error(
69 "AccordionTrigger/AccordionContent must be used within an AccordionItem"
70 );
71 return ctx;
72}
73
74// ─── AccordionGroup ──────────────────────────────────────────────────────────
75
76type AccordionGroupSingleProps = {
77 type?: "single";
78 value?: string;
79 defaultValue?: string;
80 onValueChange?: (value: string) => void;
81 collapsible?: boolean;
82};
83
84type AccordionGroupMultipleProps = {
85 type: "multiple";
86 value?: string[];
87// … truncated

What it pulls in

npm packages

  • framer-motion
  • @radix-ui/react-accordion
  • lucide-react

Other registry items

  • utils
  • https://www.fluidfunctionalism.com/r/springs.json
  • https://www.fluidfunctionalism.com/r/font-weight.json
  • https://www.fluidfunctionalism.com/r/shape-context.json
  • https://www.fluidfunctionalism.com/r/icon-context.json
  • https://www.fluidfunctionalism.com/r/use-proximity-hover.json

Files it writes

  • registry/radix/accordion.tsx

Facts

Registry
fluid-functionalism
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

fluidfunctionalism.com mickadesign/fluid-functionalism on GitHub Raw registry item This item as JSON

More from fluid-functionalism

All 53 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordion (Base UI)accordion-basefluid-functionalismComponentsFree3 deps
Ask User Questionsask-user-questionsfluid-functionalismComponentsFree2 deps
Badgebadgefluid-functionalismComponentsFree1 dep
Buttonbuttonfluid-functionalismComponentsFree4 deps
Button (Base UI)button-basefluid-functionalismComponentsFree4 deps
Cardcardfluid-functionalismComponentsFree1 dep
Chat Messagechat-messagefluid-functionalismComponentsFree1 dep
Checkbox Groupcheckbox-groupfluid-functionalismComponentsFree2 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