Skip to content

Commit 843e8f0

Browse files
committed
feat: add CollapsibleContent animations
1 parent 4e80068 commit 843e8f0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

apps/website/src/components/ui/collapsible.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { cn } from "@/utils/cn";
34
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
45

56
function Collapsible({ ...props }: CollapsiblePrimitive.Root.Props) {
@@ -12,9 +13,19 @@ function CollapsibleTrigger({ ...props }: CollapsiblePrimitive.Trigger.Props) {
1213
);
1314
}
1415

15-
function CollapsibleContent({ ...props }: CollapsiblePrimitive.Panel.Props) {
16+
function CollapsibleContent({
17+
className,
18+
...props
19+
}: CollapsiblePrimitive.Panel.Props) {
1620
return (
17-
<CollapsiblePrimitive.Panel data-slot="collapsible-content" {...props} />
21+
<CollapsiblePrimitive.Panel
22+
data-slot="collapsible-content"
23+
className={cn(
24+
"h-(--collapsible-panel-height) overflow-hidden text-sm transition-all duration-200 data-ending-style:h-0 data-starting-style:h-0 [&[hidden]:not([hidden='until-found'])]:hidden",
25+
className,
26+
)}
27+
{...props}
28+
/>
1829
);
1930
}
2031

0 commit comments

Comments
 (0)