Skip to content

feat: migrate accordion to Base UI#583

Merged
rohanchkrabrty merged 5 commits intomainfrom
base-accordion
Feb 6, 2026
Merged

feat: migrate accordion to Base UI#583
rohanchkrabrty merged 5 commits intomainfrom
base-accordion

Conversation

@rohanchkrabrty
Copy link
Contributor

@rohanchkrabrty rohanchkrabrty commented Feb 4, 2026

Description

Breaking Changes

  • type prop removed — replaced with multiple boolean prop
    • type="single" → multiple={false} (or omit, defaults to false)
    • type="multiple" → multiple={true} or multiple

Changes

  • Migrated Accordion component from Radix UI to Base UI primitives
  • Updated internal structure to use Base UI's Root, Item, Header, Trigger, and Panel components
  • Replaced keyframe animations with CSS transitions using Base UI's data-starting-style and data-ending-style attributes
  • Updated CSS to use Base UI data attributes

Docs & Tests

  • Updated documentation to reflect Base UI API and new multiple boolean prop
  • Fixed all 15 tests to work with Base UI's component structure

Summary by CodeRabbit

  • New Features

    • Simplified Accordion API: use multiple boolean prop instead of type string
    • Added new props: loopFocus, keepMounted, hiddenUntilFound
  • Breaking Changes

    • Removed type, collapsible, and dir props from Accordion
    • Accordion onValueChange callback now accepts optional values
  • Documentation

    • Updated Accordion component documentation for new API
  • Style

    • Improved Accordion animation transitions

@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Feb 6, 2026 4:36am

Base automatically changed from base-slider to main February 6, 2026 04:32
@rohanchkrabrty rohanchkrabrty merged commit d5a0757 into main Feb 6, 2026
3 of 5 checks passed
@rohanchkrabrty rohanchkrabrty deleted the base-accordion branch February 6, 2026 04:34
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR migrates the Accordion component from Radix UI to Base UI, replacing the type-driven configuration system with a boolean multiple prop. Component interfaces are restructured, documentation is updated, CSS animations are refactored to use height-based transitions, and tests are aligned with the new API.

Changes

Cohort / File(s) Summary
Documentation and Demo
apps/www/src/content/docs/components/accordion/index.mdx, apps/www/src/content/docs/components/accordion/demo.ts
Updated component examples from type="single"/"multiple" to multiple boolean prop. Changed documentation text from "types of behavior" to "modes" and removed Accessibility/Keyboard Navigation sections.
Props Definition
apps/www/src/content/docs/components/accordion/props.ts
Replaced type?: 'single' | 'multiple' with multiple?: boolean prop. Added loopFocus, keepMounted, and hiddenUntilFound props. Removed collapsible and dir props. Updated onValueChange signature to accept optional values.
Component Implementation
packages/raystack/components/accordion/accordion-root.tsx, packages/raystack/components/accordion/accordion-item.tsx, packages/raystack/components/accordion/accordion-trigger.tsx, packages/raystack/components/accordion/accordion-content.tsx
Migrated from Radix UI to Base UI primitives. Removed custom props interfaces and adopted Base UI's native props types. Restructured AccordionRoot to use unified prop signature with explicit multiple, value, defaultValue, and onValueChange handling. Updated displayName assignments to use literal strings.
Component Styling
packages/raystack/components/accordion/accordion.module.css
Changed trigger state selector from [data-state="open"] to [data-panel-open]. Replaced keyframe-based animations with height-driven transitions using CSS custom properties and @starting-style/@ending-style.
Tests
packages/raystack/components/accordion/__tests__/accordion.test.tsx
Updated test cases to pass multiple={true} prop and defaultValue for panel initialization. Changed assertion logic to use aria-disabled instead of disabled attribute checks.
Other
apps/www/src/components/typetable/typetable.tsx, apps/www/src/content/docs/components/slider/index.mdx
Updated Accordion usage from type='multiple' to multiple boolean prop in TypeTable. Added SliderValue to Slider documentation imports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • paanSinghCoder
  • rsbh

Poem

🐰 From Radix we hop to Base UI's embrace,
Boolean multiple sets a faster pace!
Heights dance smoothly, no keyframes today,
Props aligned bright in the component's way. ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch base-accordion

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants