Feedback

Alert

A question that needs an answer before going on.

iOSSwiftUI alertAndroidCompose AlertDialogRenders in a Screen or an Island
iOSSwiftUI alert
AndroidCompose AlertDialog

Import

ts
import {Alert} from '@hzblj/kara-ui'

Props

A modal alert with a confirm button and Cancel: SwiftUI's alert on iOS, Material's AlertDialog on Android. A native atom — it renders inside <Screen> or <Island>.

PropTypeDefaultDescription
onDismiss*() => void—

The alert closed — either button, or on Android a tap outside or back — so turn visible off.

title*string—

The alert's heading.

visible*boolean—

Shows the alert while true.

confirmLabelstring'OK'

The confirm button's label. OK by default.

destructivebooleanfalse

Marks the confirm button destructive — the system's destructive role on iOS, the destructive colour on Android.

messagestring—

The body text, under the title.

onConfirm() => void—

The confirm button was pressed. onDismiss follows, as it does for every way the alert closes.

onDismiss*
() => void

The alert closed — either button, or on Android a tap outside or back — so turn visible off.

title*
string

The alert's heading.

visible*
boolean

Shows the alert while true.

confirmLabel'OK'
string

The confirm button's label. OK by default.

destructivefalse
boolean

Marks the confirm button destructive — the system's destructive role on iOS, the destructive colour on Android.

message
string

The body text, under the title.

onConfirm
() => void

The confirm button was pressed. onDismiss follows, as it does for every way the alert closes.

Platform notes

  • Controlled: visible presents it and onDismiss reports every way it closed, Cancel included.