Skip to content

Disclosure ​

An accordion whose summary row toggles a content region below it. The trailing chevron rotates 90deg and the region animates its height. Works uncontrolled (defaultOpen) or controlled (open + onToggle). Use it to progressively reveal secondary detail.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismDisclosure

Basic usage ​

Uncontrolled — the component tracks its own open state.

kotlin
PrismDisclosure(title = "Details") {
    Text("Collapsible content.")
}

Default open ​

Start expanded with defaultOpen while remaining uncontrolled.

kotlin
PrismDisclosure(title = "Details", defaultOpen = true) {
    Text("Visible on first render.")
}

Controlled ​

Drive the open state yourself with open + onToggle.

kotlin
var open by remember { mutableStateOf(false) }

PrismDisclosure(
    title = "Details",
    open = open,
    onToggle = { open = it },
) {
    Text("State owned by the caller.")
}

API ​

ParameterTypeDefaultDescription
titleString—Summary row label shown beside the chevron.
modifierModifierModifierModifier applied to the root column.
defaultOpenBooleanfalseInitial open state for uncontrolled usage.
openBoolean?nullControlled open state; pair with onToggle.
onToggle((Boolean) -> Unit)?nullCalled with the next open state when the summary is activated.
content@Composable ColumnScope.() -> Unit—Revealed content rendered below the summary when open.

Released under the MIT License.