Skip to content

Empty states - Frameworks

Empty states are used to fill spaces when no content can be shown to the user, or is temporarily empty due to the nature of the feature.

AndroidreleasediOSreleased

Android

Syntax

kotlin
@Composable
fun WarpState(
    modifier: Modifier = Modifier,
    type: WarpStateType? = null,
    painter: Painter? = null,
    icon: WarpIconResource? = null,
    tintColor: Color? = null,
    imageSize: Dp? = null,
    imageContentDescription: String? = null,
    title: String? = null,
    description: String? = null,
    primaryButtonText: String? = null,
    onPrimaryButtonClicked: () -> Unit = {},
    quietButtonText: String? = null,
    onQuietButtonClicked: () -> Unit = {},
    showLogo: Boolean = false
)

Visual options & Usage

There are pre-defined types of WarpState that can be used out-of-the-box. If no type is provided all the fields will be null and you can customize freely. Supports illustrations by using the painter property.

kotlin
enum class WarpStateType {
    NoSearchResults,
    LoadFailed,
    Loading,
    Login,
    Offline,
    Verify
}

WarpState(
    type = WarpStateType.NoSearchResults,
    onPrimaryButtonClicked = { }
)

WarpState(
    type = WarpStateType.Login,
    onPrimaryButtonClicked = { },
    onQuietButtonClicked = { }
)

//Custom state with icon
WarpState(
    modifier = Modifier.fillMaxSize(),
    title = "Custom title",
    description = "Custom text and custom content.",
    icon = icons.shovel,
    primaryButtonText = "Primary action",
    onPrimaryButtonClicked = { },
    quietButtonText = "Secondary action",
    onQuietButtonClicked = { }
)

//Custom state with illustration
WarpState(
    modifier = Modifier.fillMaxSize(),
    title = "Custom state",
    description = "Custom text and custom content.",
    painter = painterResource(R.drawable.warp_placeholder),
    imageContentDescription = "Placeholder illustration",
    primaryButtonText = "Okay",
    onPrimaryButtonClicked = { },
    quietButtonText = "Retry",
    onQuietButtonClicked = { }
        )

Legacy support

Not supported

Parameters

Optional Props

NameTypeDefaultDescription
modifierModifierModifierModifier for the state component
typeWarpStateType.NoSearchResults WarpStateType.LoadFailed WarpStateType.Offline WarpStateType.Login WarpStateType.Verify WarpStateType.LoadingnullPre-defined type of the state
painterPainternullPainter for the illustration of the state component
iconWarpIconResourcenullIcon for the state component
tintColorColornullIcon color for the state component
imageSizeDpnullImage size
imageContentDescriptionStringnullContent description of the illustration
titleStringnullTitle to be displayed in the state
descriptionStringnullDescription text to be displayed in the state
primaryButtonTextStringnullText to be displayed on the primary button
onPrimaryButtonClicked() -> UnitnullAction when primary button is clicked
quietButtonTextStringnullText to be displayed on the quiet button
onQuietButtonClicked() -> UnitnullAction when quiet button is clicked
showLogoBooleanfalseToggle to show the Vend Logo

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system