Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
AIAndroid

Approval card

Ask for an approve or reject decision on an application-owned request.

Public APILumenApprovalCardAndroid / Compose

Native example

Use Approval card

The host authorizes and runs the operation, then updates status. Both buttons disable once decided.

Approval card rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun DeleteApprovalExample(deleteProjects: () -> Unit) {
    var status by remember { mutableStateOf(LumenApprovalStatus.Pending) }

    LumenApprovalCard(
        label = "Delete 3 archived projects?",
        requestId = "request-42",
        statusLabel = when (status) {
            LumenApprovalStatus.Pending -> "Waiting for your decision"
            LumenApprovalStatus.Approved -> "Approved"
            LumenApprovalStatus.Rejected -> "Rejected. Nothing was deleted."
        },
        status = status,
        onResponse = { _, response ->
            if (response == LumenApprovalResponse.Approve) {
                deleteProjects()
                status = LumenApprovalStatus.Approved
            } else {
                status = LumenApprovalStatus.Rejected
            }
        }
    ) {
        Text("The assistant wants to permanently delete Atlas, Beacon, and Comet.")
    }
}
Android
A card asking for a decision whose approve and reject buttons answer only a pending request with an ID; the host authorizes the action and updates the status.

Reference

Public API

The primary shared and platform-specific options exposed by LumenApprovalCard.

APIValues or typeDefaultDescription
requestId / status / onResponserequest identity / decision / response callbackrequired / pending / requiredThe host authorizes and runs the operation, then updates status.

Native behavior

Design and accessibility

When to use it

The host authorizes and runs the operation, then updates status. Both buttons disable once decided.

Accessibility

Card named by its label; decision status announced politely.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module