팝업 확인 (Popconfirm)
작업에 대한 버블 확인 상자를 팝업합니다.
언제 사용하나요
- 간단하고 컴팩트한 대화 상자는 사용자 확인을 요청하는 데 사용됩니다.
- 확인 모달 대화 상자와의 차이점은 정적으로 팝업되는 전체 화면 확인 모달보다 더 가볍다는 것입니다.
기본
기본 예제입니다.
astro
---
import Popconfirm from '@/components/feedback/Popconfirm.astro';
import Button from '@/components/general/Button.astro';
---
<Popconfirm title="Are you absolutely sure?" description="This action cannot be undone.">
<Button variant="danger">Delete Account</Button>
</Popconfirm>
<script>
document.addEventListener('popconfirm:confirm', (e) => {
console.log('Confirmed!', e.detail.id);
});
</script> 배치
4가지 배치 옵션을 사용할 수 있습니다.
astro
---
import Popconfirm from '@/components/feedback/Popconfirm.astro';
import Button from '@/components/general/Button.astro';
---
<Popconfirm title="Are you sure delete this task?" position="top">
<Button variant="outline">Top</Button>
</Popconfirm>
<Popconfirm title="Are you sure delete this task?" position="left">
<Button variant="outline">Left</Button>
</Popconfirm>
<Popconfirm title="Are you sure delete this task?" position="right">
<Button variant="outline">Right</Button>
</Popconfirm>
<Popconfirm title="Are you sure delete this task?" position="bottom">
<Button variant="outline">Bottom</Button>
</Popconfirm> 로케일 텍스트
버튼 레이블을 사용자 지정하려면 confirmText 및 cancelText 속성을 설정하세요.
astro
---
import Popconfirm from '@/components/feedback/Popconfirm.astro';
import Button from '@/components/general/Button.astro';
---
<Popconfirm title="Are you sure?" confirmText="Yes" cancelText="No">
<Button variant="outline">Delete a task</Button>
</Popconfirm> API 참조
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| title | The title of the confirmation dialog. | string | - |
| description | Additional descriptive text. | string | - |
| confirmText | The text for the confirmation button. | string | "Yes" |
| cancelText | The text for the cancellation button. | string | "No" |
| position | The preferred placement of the popconfirm. | "top" | "bottom" | "left" | "right" | "top" |