Alert-dialog
How to use the Alert-dialog component from the Default kit.
import { Canvas } from "@react-three/fiber"; import { Fullscreen } from "@react-three/uikit"; import { Defaults, DialogAnchor } from "@react-three/uikit-default"; import { Text } from '@react-three/uikit' import { Button } from "@react-three/uikit-default" import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@react-three/uikit-default" function AlertDialogDemo() { return ( <AlertDialog> <AlertDialogTrigger> <Button variant="outline"> <Text>Show Dialog</Text> </Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle> <Text>Are you absolutely sure?</Text> </AlertDialogTitle> <AlertDialogDescription> <Text> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </Text> </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel> <Text>Cancel</Text> </AlertDialogCancel> <AlertDialogAction> <Text>Continue</Text> </AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> ) } export default function App() { return ( <Canvas style={{ position: "absolute", inset: "0", touchAction: "none" }} gl={{ localClippingEnabled: true }}> <ambientLight intensity={0.5} /> <directionalLight intensity={1} position={[-5, 5, 10]} /> <Defaults> <Fullscreen overflow="scroll" scrollbarColor="black" backgroundColor="white" dark={{ backgroundColor: "black" }} flexDirection="column" gap={32} paddingX={32} alignItems="center" padding={32} > <DialogAnchor><AlertDialogDemo /></DialogAnchor> </Fullscreen> </Defaults> </Canvas> ) }
npx uikit component add default alert-dialog