React

Alert Dialog

사용자의 확인이 반드시 필요한 경우 강력한 표현 및 경고 수단으로 활용하는 컴포넌트입니다.

Stackflow

Stackflow와 Alert Dialog를 함께 사용하는 방법에 대해 알아보세요.

Installation

npx @seed-design/cli@latest add ui:alert-dialog

Props

AlertDialogRoot

Prop

Type

childrenReact.ReactNode
open?boolean | undefined
defaultOpen?boolean | undefined
onOpenChange?((open: boolean, details?: DialogChangeDetails) => void) | undefined

AlertDialogTrigger

Prop

Type

AlertDialogContent

Prop

Type

layerIndex?number | undefined

AlertDialogHeader

Prop

Type

AlertDialogTitle

Prop

Type

AlertDialogDescription

Prop

Type

AlertDialogFooter

Prop

Type

Examples

Trigger

<AlertDialogTrigger>aria-haspopup="dialog" 속성을 설정하고, AlertDialog의 open 상태에 따라 aria-expanded 속성을 자동으로 설정합니다. 이 속성은 스크린 리더와 같은 보조 기술에 유용합니다.

Responsive Wrapping

<ResponsivePair> 컴포넌트를 사용해 버튼 컨텐츠가 길어지는 경우 레이아웃을 세로로 접을 수 있습니다.

Single Action

Neutral Secondary Action

Nonpreferred

Critical Action

Controlled

Trigger 외의 방식으로 AlertDialog를 열고 닫을 수 있습니다. 이 경우 open prop을 사용하여 AlertDialog의 상태를 제어합니다.

Prevent Close

AlertDialogActiononClick에서 e.preventDefault()를 호출하면 다이얼로그가 닫히지 않습니다.

onOpenChange Details

onOpenChange 두 번째 인자로 details가 제공됩니다.

reason

열릴 때 (open: true)

  • "trigger": AlertDialogTrigger (Dialog.Trigger)로 열림

닫힐 때 (open: false)

  • "closeButton": AlertDialogAction으로 닫힘
  • "escapeKeyDown": ESC 키 사용
  • "interactOutside": 외부 영역 클릭
    • AlertDialogRoot는 기본적으로 closeOnInteractOutside={false}입니다. interactOutside는 이 옵션을 true로 설정한 경우에만 발생할 수 있습니다.

Portalled

Portal은 기본적으로 document.body에 렌더링됩니다.

Skip Animation

skipAnimation prop을 사용하여 AlertDialog의 enter/exit 애니메이션을 건너뛸 수 있습니다.

Stackflow

Loading...

Last updated on

On this page