Skip to content

Commit 802d4bd

Browse files
committed
docs: update collapsible
1 parent 78a9e44 commit 802d4bd

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

website/data/components/collapsible.mdx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,22 @@ const service = useMachine(collapsible.machine, {
8888
})
8989
```
9090

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+
91107
### Animating the collapsible
92108

93109
Use CSS animations to animate the collapsible when it expands and collapses. The
@@ -172,9 +188,10 @@ root, trigger and content.
172188

173189
### Collapse animation
174190

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.
178195

179196
```css
180197
[data-scope="collapsible"][data-part="content"][data-state="open"] {

0 commit comments

Comments
 (0)