StylishEmptyState

fun StylishEmptyState(icon: ImageVector? = null, title: String, description: String, modifier: Modifier = Modifier, actionLabel: String? = null, onAction: () -> Unit? = null, titleMaxLines: Int = Int.MAX_VALUE, titleOverflow: TextOverflow = TextOverflow.Ellipsis, titleStyle: TextStyle = MaterialTheme.typography.headlineMedium, descriptionMaxLines: Int = Int.MAX_VALUE, descriptionOverflow: TextOverflow = TextOverflow.Ellipsis, descriptionStyle: TextStyle = MaterialTheme.typography.bodyMedium, iconTint: Color = MaterialTheme.colorScheme.onSurfaceVariant, contentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant, iconContentDescription: String? = null, enabled: Boolean = true, iconContent: @Composable () -> Unit? = null, titleContent: @Composable () -> Unit? = null, descriptionContent: @Composable () -> Unit? = null, action: @Composable () -> Unit? = null)

A placeholder displayed when a list or content area has no data, presenting an optional icon, title, description, and an optional call-to-action.

The component centers its children vertically and horizontally within the space granted by modifier; callers that want it to occupy all available space add Modifier.fillMaxSize() themselves. When an icon vector is supplied it is rendered with iconTint; provide iconContent to replace it with arbitrary composable content, or leave both null to omit the icon entirely. The title and description each render a Text from their string unless a titleContent / descriptionContent slot is provided; blank strings without a slot render nothing. The action area renders a TextButton with actionLabel when both actionLabel and onAction are non-null, or the custom action composable when provided. If neither action parameter is set, no action area is shown.

Parameters

icon

The optional ImageVector displayed above the title. Rendered only when non-null and iconContent is not provided.

title

The headline text describing the empty state. Skipped when blank and titleContent is null.

description

The explanatory text shown below the title. Skipped when blank and descriptionContent is null.

actionLabel

The label for the optional call-to-action button. When null (or when onAction is null), no default button is rendered.

onAction

The callback invoked when the default action button is clicked. When null, no default button is rendered even if actionLabel is set.

titleMaxLines

Maximum number of lines for the title. Defaults to Int.MAX_VALUE (unlimited).

titleOverflow

The TextOverflow strategy for the title. Defaults to TextOverflow.Ellipsis.

titleStyle

The TextStyle for the title. Defaults to MaterialTheme.typography.headlineMedium.

descriptionMaxLines

Maximum number of lines for the description. Defaults to Int.MAX_VALUE (unlimited).

descriptionOverflow

The TextOverflow strategy for the description. Defaults to TextOverflow.Ellipsis.

descriptionStyle

The TextStyle for the description. Defaults to MaterialTheme.typography.bodyMedium.

iconTint

The tint color applied to the default icon. Defaults to MaterialTheme.colorScheme.onSurfaceVariant.

contentColor

The color applied to the title and description text. Defaults to MaterialTheme.colorScheme.onSurfaceVariant.

iconContentDescription

An optional content description for the default icon, announced by screen readers. When null (the default), the icon stays decorative and is skipped by accessibility services.

enabled

Whether the default action button is interactive. When false, onAction is not invoked and the button renders disabled. Defaults to true. Custom action slots are not affected.

iconContent

An optional custom composable that replaces the default icon. When null, the icon vector is rendered (if non-null). Note: the default icon includes bottom spacing from StylishTheme.dimensions.contentSpacing; custom slots do not inherit this spacing.

titleContent

An optional custom composable that replaces the default title Text. When null, the title string is rendered unless blank.

descriptionContent

An optional custom composable that replaces the default description Text. When null, the description string is rendered unless blank. Note: the default description includes top spacing from StylishTheme.dimensions.itemSpacing; custom slots do not inherit this spacing.

action

An optional custom composable that replaces the default action button. When null, the default TextButton logic applies.