Disclosure

fun Disclosure(state: DisclosureState = rememberDisclosureState(), modifier: Modifier = Modifier, content: @Composable DisclosureScope.() -> Unit)

A foundational component used to build disclosure widgets.

For interactive preview & code examples, visit Disclosure Documentation.

Basic Example

val disclosureState = rememberDisclosureState()

Disclosure(state = disclosureState) {
DisclosureHeading(
shape = RoundedCornerShape(8.dp),
backgroundColor = Color.White,
borderColor = Color(0xFFE4E4E4),
borderWidth = 1.dp
) {
Text("Click to expand")
}
DisclosurePanel {
Text("This is the expanded content")
}
}

Parameters

state

The DisclosureState that controls the expanded state of the disclosure.

modifier

Modifier to be applied to the disclosure.

content

The content of the disclosure, which should contain a DisclosureHeading and a DisclosurePanel.