@@ -88,6 +88,22 @@ const service = useMachine(collapsible.machine, {
88
88
})
89
89
```
90
90
91
+ ### Partial collapse (setting minimum dimensions)
92
+
93
+ Use the ` collapsedHeight ` or ` collapsedWidth ` machine context properties to
94
+ create a "partially collapsed" state. When collapsed, the content will maintain
95
+ the specified minimum dimensions instead of collapsing to ` 0px ` .
96
+
97
+ ``` jsx {3}
98
+ const service = useMachine (collapsible .machine , {
99
+ // Content shows 100px height when collapsed
100
+ collapsedHeight: " 100px" ,
101
+ })
102
+ ```
103
+
104
+ This is useful for creating "show more/less" content sections or preview states
105
+ where a portion of the content shows even when collapsed.
106
+
91
107
### Animating the collapsible
92
108
93
109
Use CSS animations to animate the collapsible when it expands and collapses. The
@@ -172,9 +188,10 @@ root, trigger and content.
172
188
173
189
### Collapse animation
174
190
175
- The collapsible content provides ` --width ` and ` --height ` CSS variables that can
176
- be used to create smooth animations. These variables are automatically
177
- calculated and updated based on the content's dimensions.
191
+ The collapsible content provides ` --width ` , ` --height ` , ` --collapsed-width ` , and
192
+ ` --collapsed-height ` CSS variables that can be used to create smooth animations.
193
+ These variables are automatically calculated and updated based on the content's
194
+ dimensions.
178
195
179
196
``` css
180
197
[data-scope = " collapsible" ][data-part = " content" ][data-state = " open" ] {
0 commit comments