Dialog

fun Dialog(open: Boolean, onOpenChange: (Boolean) -> Unit, content: @Composable DialogScope.() -> Unit)(source)

Shadcn/ui-style Dialog root — mirrors Dialog with a controlled open state.

A dialog is a temporary window that sits on top of the main UI, requiring user interaction before they can return to the previous screen. It is used for confirmations, small forms, or focused tasks.

In Kindling, the trigger is typically any external composable that calls onOpenChange(true).

Example usage:

var isDialogOpen by remember { mutableStateOf(false) }

// Trigger
KButton("Edit Profile", onClick = { isDialogOpen = true })

Dialog(
open = isDialogOpen,
onOpenChange = { isDialogOpen = it }
) {
DialogContent {
DialogHeader {
DialogTitle("Edit profile")
DialogDescription("Update your account information below.")
}
// Form content...
DialogFooter(showCloseButton = true, onDismiss = { isDialogOpen = false }) {
KButton("Save Changes", onClick = { /* Save */})
}
}
}

Parameters

open

Whether the dialog is currently visible.

onOpenChange

Callback invoked when the open state should change (e.g., when the user clicks outside).

content

The structured content of the dialog, typically including DialogContent.