문서 콘텐츠와 미디어

UIFullscreen

선택한 요소를 브라우저 전체 화면으로 전환합니다.

기본 사용법

발표 미리보기 전체 화면으로 열기

전체 화면 버튼을 누르면 발표 미리보기 영역이 커집니다. 닫기 버튼이나 Escape로 돌아옵니다.

11월 점검 결과

다음 정기 점검은 11월 16일입니다.

전체 화면 전환 대기
<script setup lang="ts">
import { UIButton, UIFullscreen } from "@connextable/ui";
import { ref } from "vue";

const feedback = ref("전체 화면 전환 대기");

async function toggle(
  active: boolean,
  enter: () => Promise<{ ok: boolean }>,
  exit: () => Promise<{ ok: boolean }>,
) {
  const result = await (active ? exit() : enter());
  feedback.value = result.ok
    ? "전체 화면 전환 완료"
    : "전체 화면으로 전환하지 못했습니다.";
}
</script>

<template>
  <UIFullscreen as-child v-slot="{ snapshot, enter, exit }">
    <section class="presentation" aria-label="발표 미리보기">
      <strong>11월 점검 결과</strong>
      <p>다음 정기 점검은 11월 16일입니다.</p>
      <UIButton
        size="sm"
        variant="outline"
        :disabled="!snapshot?.available"
        :loading="Boolean(snapshot?.pending)"
        @click="toggle(snapshot?.active ?? false, enter, exit)"
      >
        {{ snapshot?.active ? "전체 화면 닫기" : "전체 화면으로 보기" }}
      </UIButton>
      <small v-if="snapshot && !snapshot.available">
        현재 환경에서는 전체 화면을 사용할 수 없습니다.
      </small>
    </section>
  </UIFullscreen>
</template>

<style scoped>
.presentation {
  padding: var(--ui-space-lg);
  color: var(--ui-color-text);
  background: var(--ui-color-surface);
}
.presentation:fullscreen {
  display: grid;
  align-content: center;
  justify-items: center;
}
.presentation small {
  display: block;
  margin-block-start: var(--ui-space-sm);
}
</style>

주요 API

속성과 모델

as / as-child

전체 화면으로 전환할 요소를 연결합니다. as-child로 이미 배치한 컨테이너 한 개를 사용할 수 있습니다.

발표 미리보기 전체 화면으로 열기 예제

입력 상태

disabled타입boolean | undefined

요소의 전체 화면 연결을 비활성화합니다.

슬롯

#default타입(state: FullscreenControls & { snapshot: FullscreenSnapshot | undefined; error: FullscreenErrorCode | undefined; }) => unknown

snapshot에서 사용 가능 여부, 현재 상태, 처리 중인 전환을 읽습니다. enter와 exit는 작업 결과를 반환하며 error는 연결 오류를 나타냅니다. enter는 버튼 클릭 같은 사용자 동작에서 호출합니다.

발표 미리보기 전체 화면으로 열기 예제

컴포저블

useFullscreen

직접 관리하는 요소 ref에 전체 화면 전환을 연결합니다.

전체 속성, 이벤트와 슬롯

UIFullscreen

as
PrimitiveAs | undefined
as-child
boolean | undefined
disabled
boolean | undefined
#default
(state: FullscreenControls & { snapshot: FullscreenSnapshot | undefined; error: FullscreenErrorCode | undefined; }) => unknown