react-accessible-accordion is a React component library providing a WAI-ARIA compliant accordion interface. The current stable version is 5.0.1. While it provides robust accessibility features for accordions, the project is officially no longer maintained, with the developers strongly recommending the use of native HTML `<details>` and `<summary>` elements for new implementations due to their superior performance, framework-agnostic nature, and built-in accessibility. Releases have been infrequent, primarily addressing bug fixes or adapting to new React versions, rather than active feature development. Key differentiators historically included its out-of-the-box WAI-ARIA compliance and a component-based API for building accordions within React applications, but these are now largely superseded by native browser capabilities. It ships with TypeScript types for improved developer experience.
npm install react-accessible-accordionVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic accessible accordion with two expandable items, using named imports for components and an optional demo stylesheet. It also explicitly shows `uuid` for consistent IDs, although often automatically generated.
For new implementations, consider using native `<details>` and `<summary>` HTML elements. For existing projects, be aware that active development and new features are unlikely.
If `role="region"` is still desired for specific use cases, add the `region` boolean prop directly to the `AccordionItemPanel` component (e.g., `<AccordionItemPanel region>`).
Ensure your React environment is compatible with the `useId` hook if you are targeting specific React 18 features. For older React versions, peer dependencies `^16.3.2 || ^17.0.0 || ^18.0.0` still allow usage, but be mindful of potential SSR hydration issues specific to `useId` if encountering them.
Copy the contents of `fancy-example.css` into your project and adapt them, or create entirely new styles for your accordion components. Importing `react-accessible-accordion/dist/fancy-example.css` is only a quick way to get some basic visual feedback.
Add the `region` boolean prop to your `AccordionItemPanel` component (e.g., `<AccordionItemPanel region>`) to re-enable the role.
Ensure that any `id` props provided manually are unique and adhere to HTML5 ID naming conventions. If not providing IDs, ensure the library's automatic ID generation functions correctly without conflicts, especially in complex or dynamic rendering scenarios.
Verify the import statement `import 'react-accessible-accordion/dist/fancy-example.css';` is correct. If issues persist, manually locate the file in `node_modules` or download its contents and include it directly in your project.