Alert Dialog
중요한 내용을 사용자에게 알리고 응답을 요구하는 모달 다이얼로그입니다.
설치
사용법
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">다이얼로그 보기</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>신청을 취소하시겠습니까?</AlertDialogTitle>
<AlertDialogDescription>
취소하면 작성 중인 신청 내용이 저장되지 않습니다.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>취소</AlertDialogCancel>
<AlertDialogAction>계속</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>구성
다음 조합으로 AlertDialog:
AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
├── AlertDialogHeader
│ ├── AlertDialogMedia
│ ├── AlertDialogTitle
│ └── AlertDialogDescription
└── AlertDialogFooter
├── AlertDialogCancel
└── AlertDialogAction예제
기본
제목, 설명, 취소/계속 버튼을 포함한 기본 Alert Dialog입니다.
작은 크기
size="sm" prop으로 Alert Dialog를 더 작게 만듭니다.
미디어
AlertDialogMedia 컴포넌트로 아이콘이나 이미지 같은 미디어 요소를 Alert Dialog에 추가합니다.
작은 크기 with Media
size="sm" prop으로 Alert Dialog를 작게 만들고, AlertDialogMedia 컴포넌트로 아이콘이나 이미지 같은 미디어 요소를 추가합니다.
위험 작업
AlertDialogAction 컴포넌트로 위험 작업 액션 버튼을 Alert Dialog에 추가합니다.
RTL
RTL 지원을 활성화하려면 RTL 설정 가이드를 참고하세요.
API 참조
size
AlertDialogContent의 size prop으로 Alert Dialog의 크기를 제어합니다. 다음 값을 사용할 수 있습니다:
| 속성 | 타입 | 기본값 |
|---|---|---|
size | "default" | "sm" | "default" |
나머지 컴포넌트와 prop 정보는 Radix UI 문서를 참고하세요.