Description
In the radix-luma style, AccordionContent applies h-(--radix-accordion-content-height) on the inner <div> wrapper. This locks the content height to whatever Radix measured when the accordion first opened, which clips any content that changes size dynamically after opening.
Reproduction
- Create an accordion with a list that can expand (e.g., "Show all items" button that reveals more entries)
- Open the accordion
- Click the button to expand the list
- The newly added items are clipped/cut off — you cannot scroll to see them
Root Cause
In accordion.tsx, the AccordionContent component:
<AccordionPrimitive.Content
className="overflow-hidden px-4 text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
>
<div className={cn(
"h-(--radix-accordion-content-height) pt-0 pb-4 ...", // ← this
className
)}>
{children}
</div>
</AccordionPrimitive.Content>
--radix-accordion-content-height is a CSS variable set by Radix at open time for the animation. The outer AccordionPrimitive.Content already uses it correctly via animate-accordion-down/animate-accordion-up. Applying it as a fixed h-() on the inner div serves no purpose after the animation completes and prevents the content from growing.
Fix
Remove h-(--radix-accordion-content-height) from the inner div:
- "h-(--radix-accordion-content-height) pt-0 pb-4 [&_a]:underline ...",
+ "pt-0 pb-4 [&_a]:underline ...",
Affected Style
radix-luma (confirmed via npx shadcn@latest view @shadcn/accordion)
Description
In the
radix-lumastyle,AccordionContentappliesh-(--radix-accordion-content-height)on the inner<div>wrapper. This locks the content height to whatever Radix measured when the accordion first opened, which clips any content that changes size dynamically after opening.Reproduction
Root Cause
In
accordion.tsx, theAccordionContentcomponent:--radix-accordion-content-heightis a CSS variable set by Radix at open time for the animation. The outerAccordionPrimitive.Contentalready uses it correctly viaanimate-accordion-down/animate-accordion-up. Applying it as a fixedh-()on the inner div serves no purpose after the animation completes and prevents the content from growing.Fix
Remove
h-(--radix-accordion-content-height)from the inner div:Affected Style
radix-luma(confirmed vianpx shadcn@latest view @shadcn/accordion)