BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nexvyn/accordion

Accordion

nexvyn/accordion
FreeComponent

A vertically stacked set of interactive headings that each reveal a section of content, with a grid-rows unfold animation and full keyboard support.

Live preview

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

Install it

npx shadcn@latest add https://ui.nexvyn.dev/r/accordion.json

Source

components/ui/accordion.tsxui.nexvyn.dev/r/accordion.json · first 6 KB
1'use client'
2
3import {
4 createContext,
5 forwardRef,
6 useCallback,
7 useContext,
8 useId,
9 useMemo,
10 useState,
11 type HTMLAttributes,
12 type ReactNode,
13} from 'react'
14import { useReducedMotion } from 'motion/react'
15import { cn } from '@/lib/utils'
16
17interface AccordionContextValue {
18 type: 'single' | 'multiple'
19 collapsible: boolean
20 expandedValues: string[]
21 toggle: (value: string) => void
22 reducedMotion: boolean
23}
24
25const AccordionContext = createContext<AccordionContextValue | null>(null)
26
27function useAccordionCtx(componentName: string) {
28 const ctx = useContext(AccordionContext)
29 if (!ctx) throw new Error(`${componentName} must be used within <Accordion>`)
30 return ctx
31}
32
33interface AccordionItemContextValue {
34 value: string
35 isExpanded: boolean
36 disabled: boolean
37 triggerId: string
38 contentId: string
39}
40
41const AccordionItemContext = createContext<AccordionItemContextValue | null>(null)
42
43function useAccordionItemCtx(componentName: string) {
44 const ctx = useContext(AccordionItemContext)
45 if (!ctx) throw new Error(`${componentName} must be used within <AccordionItem>`)
46 return ctx
47}
48
49export interface AccordionProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
50 type: 'single' | 'multiple'
51 collapsible?: boolean
52 value?: string | string[]
53 defaultValue?: string | string[]
54 onValueChange?: (value: string | string[]) => void
55 className?: string
56 children?: ReactNode
57}
58
59export const Accordion = forwardRef<HTMLDivElement, AccordionProps>(
60 (
61 {
62 type,
63 collapsible = false,
64 value: valueProp,
65 defaultValue,
66 onValueChange,
67 className,
68 children,
69 ...props
70 },
71 ref,
72 ) => {
73 const isControlled = valueProp !== undefined
74 const reducedMotion = useReducedMotion() ?? false
75
76 const normalizeValue = useCallback((v: string | string[] | undefined): string[] => {
77 if (v === undefined) return []
78 if (Array.isArray(v)) return v
79 return v ? [v] : []
80 }, [])
81
82 const [internal, setInternal] = useState<string[]>(() => normalizeValue(defaultValue))
83 const expandedValues = isControlled ? normalizeValue(valueProp) : internal
84
85 const toggle = useCallback(
86 (itemValue: string) => {
87 const isExpanded = expandedValues.includes(itemValue)
88
89 let next: string[]
90
91 if (type === 'single') {
92 if (isExpanded) {
93 next = collapsible ? [] : expandedValues
94 } else {
95 next = [itemValue]
96 }
97// … truncated

What it pulls in

npm packages

  • motion

Files it writes

  • components/ui/accordion.tsx

Facts

Registry
nexvyn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

Docs on nexvyn ui.nexvyn.dev Nexvyn/Nexvyn-ui on GitHub Raw registry item This item as JSON

More from nexvyn

All 40 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Action Buttonaction-buttonnexvynComponentsFree3 deps · 4 files
Adaptive Actionsadaptive-actionsnexvynComponentsFree1 dep
AI Inputai-inputnexvynComponentsFree1 dep · 2 files
BadgebadgenexvynComponentsFree2 deps · 2 files
Bars Themebars-themenexvynComponentsFree1 dep · 3 files
Bounce Sidebarbounce-sidebarnexvynComponentsFree1 dep · 2 files
BreadcrumbsbreadcrumbsnexvynComponentsFree1 dep · 2 files
ButtonbuttonnexvynComponentsFree3 deps · 3 files

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