본문으로 건너뛰기

Popover ​

Popover는 버튼 옆에 작은 창을 띄워 추가 내용을 보여 주는 요소입니다. 주로 날짜 선택, 간단한 설정, 필터 조건 입력처럼 화면을 옮기지 않고 잠깐 처리할 작업에 사용됩니다. 스크롤 영역 안에서 열어도 창이 잘리지 않고, 바깥을 누르거나 Escape 키를 누르면 닫힙니다.

State ​

Code ​

vue
<script setup>
import { ref } from 'vue'
import { APopover, AButton, ACalendar } from '@mobigen/rnd-design-system'

const open = ref(false)
const date = ref(new Date(2024, 0, 22))
</script>

<template>
  <APopover v-model="open" :panel-width="280" :panel-max-height="320">
    <template #trigger="{ toggle }">
      <AButton variant="secondary" @click="toggle">기간 선택 열기</AButton>
    </template>
    <template #content>
      <ACalendar v-model="date" />
    </template>
  </APopover>
</template>

Props ​

속성값
modelValuetrue, false
panelWidthNumber
panelMaxHeightNumber
placementauto, bottom, top
alignstart, end
autoFocustrue, false

Events ​

이벤트전달 값
update:modelValueBoolean

Slots ​

슬롯전달 값
trigger{ open, toggle, close }
content{ close }

Methods ​

이름설명
updatePosition()트리거 위치를 기준으로 패널 위치를 다시 계산한다.

Notes ​

  • 패널 컨테이너에는 배경·테두리·그림자가 없다. content 슬롯에 넣는 내용이 담당한다.
  • 패널 컨테이너에 role이 없고, 트리거에 aria-expanded/aria-haspopup을 자동으로 붙이지 않는다. 호출부가 trigger 슬롯의 open으로 직접 붙여야 한다.