Components
AlertDialog
알림 다이얼로그 컴포넌트
AlertDialog
알림 다이얼로그는 사용자 확인이 필요한 작업에 사용하는 모달 대화 상자입니다.
기본 사용법
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel,} from '@aift/ui/AlertDialog';export default function Preview() { return ( <AlertDialog> <AlertDialogTrigger>열기</AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>알림</AlertDialogTitle> <AlertDialogDescription> 이 작업을 진행하시겠습니까? </AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>취소</AlertDialogCancel> <AlertDialogAction>확인</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> );}Status
확인 버튼의 status prop으로 버튼 색상을 지정할 수 있습니다.
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel,} from '@aift/ui/AlertDialog';import { Button } from '@aift/ui/Button';export default function Status() { return ( <div className="flex flex-wrap gap-2"> <AlertDialog> <AlertDialogTrigger asChild> <Button variant="outlined">Primary</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Primary</AlertDialogTitle> <AlertDialogDescription>기본 확인 다이얼로그입니다.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>취소</AlertDialogCancel> <AlertDialogAction status="primary">확인</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> <AlertDialog> <AlertDialogTrigger asChild> <Button variant="outlined">Success</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Success</AlertDialogTitle> <AlertDialogDescription>작업이 완료되었습니다.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>취소</AlertDialogCancel> <AlertDialogAction status="success">확인</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> <AlertDialog> <AlertDialogTrigger asChild> <Button variant="outlined">Caution</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Caution</AlertDialogTitle> <AlertDialogDescription>주의가 필요한 작업입니다.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>취소</AlertDialogCancel> <AlertDialogAction status="caution">확인</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> <AlertDialog> <AlertDialogTrigger asChild> <Button variant="outlined">Error</Button> </AlertDialogTrigger> <AlertDialogContent> <AlertDialogHeader> <AlertDialogTitle>Error</AlertDialogTitle> <AlertDialogDescription>이 작업은 되돌릴 수 없습니다.</AlertDialogDescription> </AlertDialogHeader> <AlertDialogFooter> <AlertDialogCancel>취소</AlertDialogCancel> <AlertDialogAction status="error">삭제</AlertDialogAction> </AlertDialogFooter> </AlertDialogContent> </AlertDialog> </div> );}Props
AlertDialog는 Radix UI의 Alert Dialog를 기반으로 하며, 여러 하위 컴포넌트로 구성됩니다.
AlertDialog: 루트 컴포넌트AlertDialogTrigger: 다이얼로그를 여는 트리거AlertDialogContent: 다이얼로그 콘텐츠AlertDialogHeader: 헤더 영역AlertDialogTitle: 제목AlertDialogDescription: 설명AlertDialogFooter: 푸터 영역AlertDialogAction: 확인 버튼 (status:'primary' \| 'secondary' \| 'info' \| 'error' \| 'caution' \| 'success')AlertDialogCancel: 취소 버튼