Skip to content

Collapsible

@Composable



fun Collapsible(
    title: Component, 
    modifier: Modifier = Modifier, 
    initiallyExpanded: Boolean = false, 
    onToggled: (isExpanded: Boolean) -> Unit = {}, 
    content: @Composable



 () -> Unit
)

A container that can be expanded or collapsed by clicking its header.

The header displays title with an animated arrow indicator that rotates 90° when the section is open. A vertical separator bar is shown to the left of the expanded content.

Example

Collapsible(title = Component.literal("Advanced Settings")) {
    // content shown when expanded
    Text(Component.literal("Option A"))
}

Parameters

  • title: The text displayed in the collapsible header.

  • modifier: Modifiers applied to the outer Column container.

  • initiallyExpanded: Whether the section starts in the expanded state.

  • onToggled: Called when the expanded state changes; receives the new state.

  • content: The composable content shown when expanded.