Alert
A question that needs an answer before going on.
Import
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>.
| Prop | Type | Default | Description |
|---|---|---|---|
| onDismiss* | () => void | — | The alert closed — either button, or on Android a tap outside or back — so turn |
| title* | string | — | The alert's heading. |
| visible* | boolean | — | Shows the alert while true. |
| confirmLabel | string | 'OK' | The confirm button's label. |
| destructive | boolean | false | 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. |
The alert closed — either button, or on Android a tap outside or back — so turn visible off.
The alert's heading.
Shows the alert while true.
The confirm button's label. OK by default.
Marks the confirm button destructive — the system's destructive role on iOS, the destructive colour on Android.
The body text, under the title.
The confirm button was pressed. onDismiss follows, as it does for every way the alert closes.
Platform notes
- Controlled:
visiblepresents it andonDismissreports every way it closed, Cancel included.