I am using jetpack compose / Kotlin to create my first android app.
I am using a navigation drawer like so
ModalNavigationDrawer(
drawerContent = {
ModalDrawerSheet {
Text(text = stringResource(id = R.string.app_name), modifier = Modifier.padding(16.dp))
Divider()
NavigationDrawerItem(
label = { Text(text = stringResource(id = R.string.settings_title)) },
icon = {Icon(
Icons.Filled.Settings,
contentDescription = stringResource(id = R.string.settings_title)
)},
selected = false,
onClick = { /*TODO*/ }
)
NavigationDrawerItem(
label = { Text(text = stringResource(id = R.string.collections)) },
icon = {Icon(
painterResource(id = R.drawable.baseline_collections_bookmark_24),
contentDescription = stringResource(id = R.string.collections)
)},
selected = false,
onClick = { /*TODO*/ }
)
// ...other drawer items
}
},
gesturesEnabled = true,
content = content
)
which gives this
I want to make the second item expandable like in this question, however all resources I find use the view system which as I understand is outdated and which anyway I know nothing about.
How can I implement this using Compose ?

There is a lot of option you can play around showing option.
I'm showing you one of the simple option to show/hide the list below the option in
ModalNavigationDrawerI have made this sample using
Material3. Checkout the complete code.MainActivity.kt
ModalNavigation.kt
Explanation about the code.
AnimatedVisibilitycomposable to show/hide content with default Animation.Preview Result