File tree 3 files changed +23
-3
lines changed
3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' fumadocs-ui ' : patch
3
+ ---
4
+
5
+ Fix sidebar layout shifts with ` defaultOpen ` option
Original file line number Diff line number Diff line change 72
72
}
73
73
}
74
74
75
+ @property --radix-collapsible-content-height {
76
+ syntax : '<length>' ;
77
+ inherits : false;
78
+ initial-value : 0px ;
79
+ }
80
+
75
81
@utility container {
76
82
margin-inline : auto;
77
83
padding-inline : 1rem ;
Original file line number Diff line number Diff line change
1
+ 'use client' ;
1
2
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible' ;
2
- import { forwardRef } from 'react' ;
3
+ import { forwardRef , useEffect , useState } from 'react' ;
3
4
import { cn } from '@/utils/cn' ;
4
5
5
6
const Collapsible = CollapsiblePrimitive . Root ;
6
7
7
8
const CollapsibleTrigger = CollapsiblePrimitive . CollapsibleTrigger ;
8
9
9
10
const CollapsibleContent = forwardRef <
10
- React . ElementRef < typeof CollapsiblePrimitive . CollapsibleContent > ,
11
+ HTMLDivElement ,
11
12
React . ComponentPropsWithoutRef < typeof CollapsiblePrimitive . CollapsibleContent >
12
13
> ( ( { children, ...props } , ref ) => {
14
+ const [ mounted , setMounted ] = useState ( false ) ;
15
+
16
+ useEffect ( ( ) => {
17
+ setMounted ( true ) ;
18
+ } , [ ] ) ;
19
+
13
20
return (
14
21
< CollapsiblePrimitive . CollapsibleContent
15
22
ref = { ref }
16
23
{ ...props }
17
24
className = { cn (
18
- 'overflow-hidden [--radix-collapsible-content-height:0px] data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down' ,
25
+ 'overflow-hidden' ,
26
+ mounted &&
27
+ 'data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down' ,
19
28
props . className ,
20
29
) }
21
30
>
You can’t perform that action at this time.
0 commit comments