nextui
nextui copied to clipboard
[Feature Request] Accordion component is too opinionated
Is your feature request related to a problem? Please describe.
The documentation states that the children
prop for the Accordion component can be either ReactNode
or ReactNode[]
.
The contents of the collection. Usually the array of AccordionItem.
However, in practice, only an array of AccordionItem
can be used. The AccordionItem
(accordion-item.tsx) used within the Accordion isn't exported. It can only be created by the Accordion component itself. The exported AccordionItem
isn't a "true" React component; it's more of a configuration object.
So, the first issue is the misleading documentation. I wasted quite a bit of time trying to create my own AccordionItem
.
The second problem is the component's opinionated structure. The entire title of the AccordionItem
is a single button, which is already causing issues for users.
Describe the solution you'd like
I would like the ability to use custom AccordionItem
s in the Accordion
component. Right now, this isn't feasible without having to rewrite both components. Less opinionated implementation also would be nice. For example, Radix UI uses two different components — Accordion.Header and AccordionTrigger.
Describe alternatives you've considered
A potential workaround is rewriting both the Accordion
and AccordionItem
, reusing the internal components such as types and hooks.
Screenshots or Videos
No response