Prompt

fun Prompt(header: String, primaryAction: PromptAction, onDismissRequest: () -> Unit, modifier: Modifier = Modifier, dialogProperties: DialogProperties = DialogProperties(), content: @Composable () -> Unit)(source)

Prompt is a modal window that appears in the centre of a screen, disabling the content below. It interrupts the user with a critical task, decision, or acknowledgement that needs to be addressed before continuing. It's built on top of androidx.compose.ui.window.Dialog and comes with a predefined appearance based on Skapa design and guidelines (https://skapa.ikea.net/).

Prompts should be short and direct and not require complex decision-making. Heading and actions should pair clearly when scanning the content. Prompts are either relevant to the users' current task or communicate important information that could affect their experience.

Parameters

header

string that contains the header text for the Prompt.

primaryAction

callback to be invoked when the primary action button is being clicked.

onDismissRequest

action to be taken when dismissing the prompt.

modifier

modifier to be applied to the Prompt.

dialogProperties

properties used to customize the behavior of a Dialog.

content

composable surface to contain any content the user wishes to display.

See also

Samples

// define a state to show/dismiss prompt
var showPrompt by remember { mutableStateOf(true) }
if (showPrompt) {
    SkapaTheme2(isSystemInDarkTheme()) {
        Prompt(
            header = "Prompt Header",
            primaryAction = PromptAction("Primary", action = { /* Do something */ }),
            // Prompt and have a secondary action
            // secondaryAction = PromptAction("Secondary", action = { /* Do something */ }),
            content = { Text(text = "Prompt body") },
            onDismissRequest = { showPrompt = false }
        )
    }
}

fun Prompt(header: String, primaryAction: PromptAction, secondaryAction: PromptAction, onDismissRequest: () -> Unit, modifier: Modifier = Modifier, buttonAlignment: FooterButtonAlignment = FooterButtonAlignment.SideBySide, dialogProperties: DialogProperties = DialogProperties(), content: @Composable () -> Unit)(source)

Prompt is a modal window that appears in the centre of a screen, disabling the content below. It interrupts the user with a critical task, decision, or acknowledgement that needs to be addressed before continuing. It's built on top of androidx.compose.ui.window.Dialog and comes with a predefined appearance based on Skapa design and guidelines (https://skapa.ikea.net/).

Prompts should be short and direct and not require complex decision-making. Heading and actions should pair clearly when scanning the content. Prompts are either relevant to the users' current task or communicate important information that could affect their experience.

Parameters

header

string that contains the header text for the Prompt.

primaryAction

callback to be invoked when the primary action button is being clicked.

secondaryAction

callback to be invoked when the secondary action button is being clicked. Nullable. If secondaryAction is null, Prompt will rely solely on primaryAction for input.

onDismissRequest

action to be taken when dismissing the prompt.

modifier

modifier to be applied to the Prompt.

buttonAlignment

enum to control if footer buttons are vertically stacked or placed in a row.

dialogProperties

properties used to customize the behavior of a Dialog.

content

composable surface to contain any content the user wishes to display.

See also

Samples

val showPrompt = remember { mutableStateOf(true) }
Prompt(
    header = "Prompt Header",
    primaryAction = PromptAction("Primary", action = { }),
    secondaryAction = PromptAction("Secondary", action = { }),
    content = { Text(text = "Prompt body") },
    onDismissRequest = { showPrompt.value = false }
)