diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ListItem.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ListItem.kt index 25f5009299..3e2fd6dcd5 100644 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ListItem.kt +++ b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/theme/components/ListItem.kt @@ -65,7 +65,41 @@ fun ListItem( disabledLeadingIconColor = ListItemDefaultColors.iconDisabled, disabledTrailingIconColor = ListItemDefaultColors.iconDisabled, ) + ListItem( + headlineContent = headlineContent, + modifier = modifier, + supportingContent = supportingContent, + leadingContent = leadingContent, + trailingContent = trailingContent, + colors = colors, + enabled = enabled, + onClick = onClick, + ) +} +/** + * A List Item component to be used in lists and menus with simple layouts, matching the Material 3 guidelines. + * @param headlineContent The main content of the list item, usually a text. + * @param modifier The modifier to be applied to the list item. + * @param supportingContent The content to be displayed below the headline content. + * @param leadingContent The content to be displayed before the headline content. + * @param trailingContent The content to be displayed after the headline content. + * @param colors The colors to use for the list item. + * @param enabled Whether the list item is enabled. When disabled, will change the color of the headline content and the leading content to use disabled tokens. + * @param onClick The callback to be called when the list item is clicked. + */ +@Suppress("LongParameterList") +@Composable +fun ListItem( + headlineContent: @Composable () -> Unit, + colors: ListItemColors, + modifier: Modifier = Modifier, + supportingContent: @Composable (() -> Unit)? = null, + leadingContent: ListItemContent? = null, + trailingContent: ListItemContent? = null, + enabled: Boolean = true, + onClick: (() -> Unit)? = null, +) { // We cannot just pass the disabled colors, they must be set manually: https://issuetracker.google.com/issues/280480132 val headlineColor = if (enabled) colors.headlineColor else colors.disabledHeadlineColor val leadingContentColor = if (enabled) colors.leadingIconColor else colors.disabledLeadingIconColor