Skip to content

Commit

Permalink
Move className overwrite of AccordionContent to the children component
Browse files Browse the repository at this point in the history
In order to have a smooth opening of the accordion, moving the AccordionContent className overwrite to the children wrapper component allow Radix to calculate correctly the animation and execute a smooth animation in case of className on the  AccordionContent.

Possibly related to #944
  • Loading branch information
shug0 authored Oct 4, 2023
1 parent 43c4023 commit 09f43aa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions apps/www/registry/default/ui/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ const AccordionContent = React.forwardRef<
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Content
ref={ref}
className={cn(
"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
className
)}
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
{...props}
>
<div className="pb-4 pt-0">{children}</div>
<div className={cn('pb-4 pt-0', className)}>{children}</div>
</AccordionPrimitive.Content>
))
));

AccordionContent.displayName = AccordionPrimitive.Content.displayName

export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }

0 comments on commit 09f43aa

Please sign in to comment.