Skip to content

Radix UI Accordion Multiple Open Not Working — Fix Type

DodaTech Updated 2026-06-24 1 min read

In this fix, you'll learn how to configure Radix UI Accordion for multiple open items. This matters for FAQ sections and expandable lists, and appears in settings panels and documentation pages.

The Problem

The following code demonstrates the typical mistake:

<Accordion type="single" collapsible>
  <AccordionItem value="1">
    <AccordionTrigger>Section 1</AccordionTrigger>
    <AccordionContent>Content 1</AccordionContent>
  </AccordionItem>
  <AccordionItem value="2">
    <AccordionTrigger>Section 2</AccordionTrigger>
    <AccordionContent>Content 2</AccordionContent>
  </AccordionItem>
</Accordion>
// Only one item can be open at a time

The Fix

Here is the corrected version:

<Accordion type="multiple" defaultValue={['1']}>
  <AccordionItem value="1">
    <AccordionTrigger>Section 1</AccordionTrigger>
    <AccordionContent>Content 1</AccordionContent>
  </AccordionItem>
  <AccordionItem value="2">
    <AccordionTrigger>Section 2</AccordionTrigger>
    <AccordionContent>Content 2</AccordionContent>
  </AccordionItem>
</Accordion>
// Multiple items can be open simultaneously

Prevention

  • Set type='multiple' to allow multiple accordion items open at once.
  • For type='single', only one item can be open at a time.
  • Use collapsible prop with type='single' to allow closing all items.
  • Default value for type='multiple' is an array of open item values.
  • Controlled mode: use value (array) and onValueChange with type='multiple'.

Common Mistakes with ui accordion multiple

  1. Misunderstanding that String is [Char] with poor performance for large text operations
  2. Using foldl instead of foldl' causing stack overflow on large lists
  3. Forgetting deriving (Show, Eq) on custom data types needed for debugging

These mistakes appear frequently in real-world RADIX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the default accordion type?

The default is type='single', which means only one AccordionItem can be open at a time. Opening one item closes any other open item.

What does the collapsible prop do?

With type='single' and collapsible, clicking an open AccordionTrigger closes it (allowing all items to be closed). Without collapsible, at least one item must always be open.

How do I control the accordion programmatically?

For type='multiple': <Accordion type='multiple' value={openItems} onValueChange={setOpenItems}>. openItems is an array of Item value strings.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro