Collapsible
A fully controlled single-section disclosure primitive with animated expand/collapse and scoped trigger and content slots.
Collapsible is a controlled disclosure primitive — the caller owns the open state and receives toggle intent via onOpenChange. Inside the trailing content lambda, CollapsibleScope exposes two slots: CollapsibleTrigger (a clickable Row) and CollapsibleContent (an AnimatedVisibility-wrapped Column with 300 ms fade + expand/shrink animation).
Basic usage
With icon
Animate an Icon rotation with animateFloatAsState to give a visual hint of the open direction.
Disabled
Set enabled = false to prevent the trigger from responding to taps. The content stays in its current open state but cannot be changed by the user.
API reference
Collapsible
| Parameter | Type | Default | Description |
|---|---|---|---|
open | Boolean | — | Whether the content is currently expanded. Owned by the caller. |
onOpenChange | (Boolean) -> Unit | — | Invoked with the requested new open state when the trigger is tapped. |
modifier | Modifier | Modifier | Applied to the root Column. |
enabled | Boolean | true | When false, the trigger does not respond to taps. |
content | @Composable CollapsibleScope.() -> Unit | — | Slot for CollapsibleTrigger and CollapsibleContent. |
CollapsibleTrigger
Scoped to CollapsibleScope. A Row that toggles open on tap.
| Parameter | Type | Default | Description |
|---|---|---|---|
modifier | Modifier | Modifier | Applied to the trigger Row. |
horizontalArrangement | Arrangement.Horizontal | Arrangement.Start | Horizontal arrangement of the trigger's children. |
verticalAlignment | Alignment.Vertical | Alignment.Top | Vertical alignment of the trigger's children. |
content | @Composable RowScope.() -> Unit | — | Trigger content. |
CollapsibleContent
Scoped to CollapsibleScope. An AnimatedVisibility wrapper that fades and expands/shrinks over 300 ms.
| Parameter | Type | Default | Description |
|---|---|---|---|
modifier | Modifier | Modifier | Applied to the inner Column. |
content | @Composable ColumnScope.() -> Unit | — | Content revealed when open is true. |