npx gluestack-ui add alert-dialogimport {
AlertDialog,
AlertDialogBackdrop,
AlertDialogContent,
AlertDialogHeader,
AlertDialogCloseButton,
AlertDialogFooter,
AlertDialogBody,
} from '@/components/ui/alert-dialog';
export default () => (
export default () => (
<AlertDialog>
<AlertDialogBackdrop />
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogCloseButton />
</AlertDialogHeader>
<AlertDialogBody />
<AlertDialogFooter />
</AlertDialogContent>
</AlertDialog>
);
);
| Prop | Type | Default | Description |
|---|---|---|---|
isOpen | boolean | false | If true, the alert-dialog will open. Useful for controllable state behavior. |
onClose | () => any | - | Callback invoked when the alert-dialog is closed. |
useRNModal | boolean | false | If true, renders react-native native modal. (Only works in react-native) |
defaultIsOpen | boolean | false | Specifies the default open state of the AlertDialog |
initialFocusRef | React.RefObject<any> | - | The ref of element to receive focus when the alert-dialog opens. |
finalFocusRef | React.RefObject<any> | - | The ref of element to receive focus when the alert-dialog closes. |
avoidKeyboard | boolean | - | If true, the AlertDialog will avoid the keyboard. |
closeOnOverlayClick | boolean | true | If true, the AlertDialog will close when the overlay is clicked. |
isKeyboardDismissable | boolean | true | If true, the keyboard can dismiss the AlertDialog |
| Name | Value | Default |
|---|---|---|
size | xs | sm | md | lg | full | md |