> ## Documentation Index
> Fetch the complete documentation index at: https://araf.badr.co.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Accordion

> A vertically stacked set of expandable sections that reveal content on click — supports single and multiple expansion modes.

## Overview

<div style={{padding:"28px 24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#fff",borderRadius:"8px",border:"1px solid #E5E7EB",overflow:"hidden",maxWidth:"480px"}}>
    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderBottom:"1px solid #E5E7EB"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>What is A'raf DS?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#71717A" strokeWidth="2" style={{transform:"rotate(180deg)"}}>
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>

    <div style={{padding:"0 20px 16px",background:"#FAFAFA",borderBottom:"1px solid #E5E7EB"}}>
      <p style={{fontSize:"13px",color:"#667085",fontFamily:"Inter,sans-serif",margin:0,lineHeight:"20px"}}>A'raf DS is a design system built for modern web applications, providing consistent tokens, components, and patterns.</p>
    </div>

    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderBottom:"1px solid #E5E7EB"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>How do I install it?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#71717A" strokeWidth="2">
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>

    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>Is dark mode supported?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#71717A" strokeWidth="2">
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>
  </div>
</div>

**Accordion** organizes content into collapsible sections, reducing cognitive load by hiding detail until needed. It supports single (only one open at a time) and multiple (many can be open) expansion modes.

***

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @araf-ds/core
  ```

  ```bash yarn theme={null}
  yarn add @araf-ds/core
  ```

  ```bash pnpm theme={null}
  pnpm add @araf-ds/core
  ```
</CodeGroup>

***

## Usage

```tsx theme={null}
import {
  Accordion,
  AccordionContent,
  AccordionItem,
  AccordionTrigger,
} from "@araf-ds/core"

export default function Example() {
  return (
    <Accordion type="single" collapsible defaultValue="item-1">
      <AccordionItem value="item-1">
        <AccordionTrigger>What is A'raf DS?</AccordionTrigger>
        <AccordionContent>
          A'raf DS is a design system built for modern web applications.
        </AccordionContent>
      </AccordionItem>
      <AccordionItem value="item-2">
        <AccordionTrigger>How do I install it?</AccordionTrigger>
        <AccordionContent>
          Install via npm: <code>npm install @araf-ds/core</code>
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  )
}
```

***

## Variants

### Single Mode (Default)

Only one item can be open at a time. Use `collapsible` to allow closing the active item.

<div style={{padding:"24px",background:"#f9fafb",borderRadius:"12px",border:"1px solid #e5e7eb"}}>
  <div style={{background:"#fff",borderRadius:"8px",border:"1px solid #E5E7EB",overflow:"hidden",maxWidth:"480px"}}>
    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderBottom:"1px solid #E5E7EB"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>What is A'raf DS?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#0479CE" strokeWidth="2" style={{transform:"rotate(180deg)"}}>
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>

    <div style={{padding:"0 20px 16px",borderBottom:"1px solid #E5E7EB"}}>
      <p style={{fontSize:"13px",color:"#667085",fontFamily:"Inter,sans-serif",margin:0,lineHeight:"20px"}}>A'raf DS is a design system built for modern web applications.</p>
    </div>

    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",borderBottom:"1px solid #E5E7EB"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>How do I install it?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#71717A" strokeWidth="2">
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>

    <div style={{padding:"16px 20px",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer"}}>
      <span style={{fontSize:"14px",fontWeight:500,color:"#101828",fontFamily:"Inter,sans-serif"}}>Is dark mode supported?</span>

      <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#71717A" strokeWidth="2">
        <path d="M6 9l6 6 6-6" />
      </svg>
    </div>
  </div>
</div>

```tsx theme={null}
<Accordion type="single" collapsible defaultValue="item-1">
  <AccordionItem value="item-1">
    <AccordionTrigger>What is A'raf DS?</AccordionTrigger>
    <AccordionContent>A'raf DS is a design system built for modern web applications.</AccordionContent>
  </AccordionItem>
  <AccordionItem value="item-2">
    <AccordionTrigger>How do I install it?</AccordionTrigger>
    <AccordionContent>Install via npm: <code>npm install @araf-ds/core</code></AccordionContent>
  </AccordionItem>
  <AccordionItem value="item-3">
    <AccordionTrigger>Is dark mode supported?</AccordionTrigger>
    <AccordionContent>Yes, all components adapt automatically via semantic tokens.</AccordionContent>
  </AccordionItem>
</Accordion>
```

### Multiple Mode

Multiple items can be open simultaneously.

```tsx theme={null}
<Accordion type="multiple" defaultValue={["item-1", "item-2"]}>
  <AccordionItem value="item-1">
    <AccordionTrigger>Section 1</AccordionTrigger>
    <AccordionContent>Content 1</AccordionContent>
  </AccordionItem>
  <AccordionItem value="item-2">
    <AccordionTrigger>Section 2</AccordionTrigger>
    <AccordionContent>Content 2</AccordionContent>
  </AccordionItem>
</Accordion>
```

***

## API Reference

### Accordion

<ParamField path="type" type="string" default="single">
  Expansion mode. Values: `single` · `multiple`
</ParamField>

<ParamField path="value" type="string | string[]">
  Controlled open item(s). String for `single`, string array for `multiple`.
</ParamField>

<ParamField path="onValueChange" type="(value) => void">
  Callback fired when the open state changes.
</ParamField>

<ParamField path="defaultValue" type="string | string[]">
  Uncontrolled default open item(s).
</ParamField>

<ParamField path="collapsible" type="boolean" default="false">
  When `true`, allows closing the active item in `single` mode by clicking it again.
</ParamField>

<ParamField path="className" type="string">
  Additional Tailwind classes for custom overrides.
</ParamField>

### AccordionItem

<ParamField path="value" type="string">
  Unique identifier for this item (required).
</ParamField>

<ParamField path="disabled" type="boolean" default="false">
  Disables this item — it cannot be opened or closed.
</ParamField>

***

## Accessibility

* Accordion follows the WAI-ARIA Accordion pattern with `role="button"` on triggers
* Triggers toggle `aria-expanded` between `true` and `false`
* Content panels use `role="region"` and `aria-labelledby` pointing to their trigger
* Enter/Space opens or closes the focused item
* Up/Down arrow keys move focus between triggers

***

## Do's & Don'ts

<CardGroup cols={2}>
  <Card title="Do" icon="check" iconType="solid" color="#16A34A">
    * Use Accordion for FAQ sections, settings groups, and structured reference content
    * Use `type="single"` for step-by-step guides where one step is active
    * Use `type="multiple"` for reference content users may want to compare
    * Keep trigger labels short — one clear phrase per item
  </Card>

  <Card title="Don't" icon="xmark" iconType="solid" color="#DC2626">
    * Don't use Accordion to hide critical information users always need
    * Don't nest accordions inside accordion content — it creates confusion
    * Don't use Accordion as a replacement for Tabs
    * Don't put primary CTAs inside accordion panels — they are easily missed
  </Card>
</CardGroup>
