문서 레이아웃

UIWindowSplitter

두 영역 사이의 경계를 움직여 크기를 조절합니다.

기본 사용법

패널 너비 조절

구분선을 끌거나 포커스한 뒤 방향키를 눌러 두 패널의 너비를 조절합니다.

프로젝트
src
App.vue읽기 전용
<script setup lang="ts">
const release = 'stable'
</script>

<template>
  <ReleaseCard :channel="release" />
</template>
<script setup lang="ts">
import { UIWindowSplitter } from "@connextable/ui";

import { ref } from "vue";

const size = ref("34");
const sources = {
  "App.vue": `<script setup lang="ts">
const release = 'stable'
<\/script>

<template>
  <ReleaseCard :channel="release" />
</template>`,
  "tokens.ts": `export const tokens = {
  gap: '0.75rem',
  radius: '0.5rem',
}`,
};
const selected = ref<keyof typeof sources>("App.vue");
</script>

<template>
  <UIWindowSplitter
    v-model="size"
    class="split-example"
    orientation="horizontal"
    :min="22"
    :max="72"
    label="프로젝트와 편집기 너비 조정"
  >
    <template #before>
      <header class="split-example__header"><strong>프로젝트</strong></header>
      <div class="split-example__files">
        <span class="split-example__folder">src</span>
        <button
          v-for="(_, file) in sources"
          :key="file"
          type="button"
          class="split-example__file"
          :aria-pressed="selected === file"
          @click="selected = file"
        >
          {{ file }}
        </button>
      </div>
    </template>
    <template #after>
      <header class="split-example__header">
        <strong>{{ selected }}</strong
        ><small>읽기 전용</small>
      </header>
      <slot name="source" :filename="selected" :code="sources[selected]">
        <pre
          tabindex="0"
          :aria-label="`${selected} 소스`"
        ><code>{{ sources[selected] }}</code></pre>
      </slot>
    </template>
  </UIWindowSplitter>
</template>

<style scoped>
.split-example {
  inline-size: 100%;
  min-block-size: 13rem;
}

.split-example :deep([data-part="pane"]) {
  padding: 0;
}

.split-example__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-xs) var(--ui-space-sm);
  min-block-size: 2.75rem;
  padding: var(--ui-space-xs) var(--ui-space-md);
  border-block-end: 1px solid var(--ui-color-divider);
  font-size: var(--ui-font-size-body-sm);
  overflow-wrap: anywhere;
}

.split-example__header small,
.split-example__folder {
  color: var(--ui-color-text-muted);
}

.split-example__files {
  display: grid;
  gap: var(--ui-space-2xs);
  padding: var(--ui-space-sm);
}

.split-example__folder,
.split-example__file {
  padding: var(--ui-space-xs);
  border: 0;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  font: inherit;
  font-size: var(--ui-font-size-body-sm);
  text-align: start;
  overflow-wrap: anywhere;
}

.split-example__file {
  padding-inline-start: var(--ui-space-sm);
  color: var(--ui-color-text);
  cursor: pointer;
}

.split-example__file[aria-pressed="true"] {
  background: var(--ui-color-accent-soft);
  color: var(--ui-color-accent);
}

.split-example__file:hover {
  background: var(--ui-color-surface-active);
}

.split-example pre {
  margin: 0;
  padding: var(--ui-space-md);
  font: 400 var(--ui-font-size-metadata)/1.65 var(--ui-font-mono);
}
</style>

설정과 동작

위아래 패널에 기본 그립 표시

thumb을 지정해 기본 그립을 표시합니다. 구분선을 끌거나 위아래 방향키를 눌러 높이를 조정합니다.

키보드로 너비 조절

구분선에 포커스를 두고 방향키로 세밀하게 조절합니다. Page Up과 Page Down을 누르면 더 크게 이동합니다.

조합과 확장

보고서 목록의 너비 조절

점 모양 손잡이를 끌어 목록과 본문의 너비를 조절합니다. 손잡이 모양은 Handle 슬롯에서 지정합니다.

구성 컴포넌트

구조와 배치

UIWindowSplitterPane

크기를 조절할 두 영역 중 하나입니다.

위아래 패널에 기본 그립 표시 예제

탐색과 동작

UIWindowSplitterHandle

패널 크기나 항목 위치를 Pointer 또는 키보드로 조절합니다.

위아래 패널에 기본 그립 표시 예제

주요 API

속성과 모델

v-model타입string | number | undefined

첫 패널이 사용하는 비율을 연결합니다.

위아래 패널에 기본 그립 표시 예제
min / max

손잡이가 이동할 수 있는 비율의 경계입니다.

위아래 패널에 기본 그립 표시 예제
step / page-step

기본 이동 간격은 0.1%p입니다. step으로 간격을 지정하고 page-step으로 Page Up과 Page Down에서 이동할 단계 수를 지정합니다.

키보드로 너비 조절 예제
format-value타입((value: string) => string) | undefined

스크린 리더가 현재 비율을 읽을 때 사용할 문구를 지정합니다.

슬롯

#before / #after

구분선 앞과 뒤에 배치할 내용을 지정합니다.

키보드로 너비 조절 예제
#grip타입() => VNodeChild

구분선의 그립 모양을 직접 구성합니다.

Handle thumb / #default

기본값은 구분선입니다. thumb을 지정하면 그립을 표시하고, 기본 슬롯으로 아이콘이나 다른 표시를 구성할 수 있습니다. 슬롯에서 value와 percentage를 읽을 수 있습니다.

전체 속성, 이벤트와 슬롯

UIWindowSplitter

min
string | number | undefined
max
string | number | undefined
step
string | number | undefined
model-value
string | number | undefined
default-value
string | number | undefined
page-step
number | undefined
orientation
"horizontal" | "vertical" | undefined
disabled
boolean | undefined
label
string | undefined
name
string | undefined
form
string | undefined
format-value
((value: string) => string) | undefined
as
PrimitiveAs | undefined
as-child
boolean | undefined
@update:model-value
(_value: string) => any
#default
(props: SliderSlotProps) => VNodeChild
#before
(state: SliderSlotProps) => VNodeChild
#after
(state: SliderSlotProps) => VNodeChild
#grip
() => VNodeChild

UIWindowSplitterPane

as
PrimitiveAs | undefined
as-child
boolean | undefined
side필수
"before" | "after"
#default
() => VNodeChild

UIWindowSplitterHandle

as
PrimitiveAs | undefined
as-child
boolean | undefined
thumb
boolean | undefined
#default
(state: SliderSlotProps) => unknown