본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

대시보드 크기조절 핸들

원문 보기 위키 갱신

대시보드 크기조절 핸들 (DashboardResizeHandle)

DashboardResizeHandle은 사이드바나 패널의 크기를 조절할 수 있는 핸들이에요. resizable prop이 설정되면 자동으로 표시되므로 직접 추가할 필요가 없어요.

출처: Nuxt UI

본문

사용법 (Usage)

DashboardResizeHandle 컴포넌트는 DashboardSidebar와 DashboardPanel 컴포넌트에서 사용돼요.

resizable prop이 설정되면 자동으로 표시되므로, 직접 추가할 필요가 없어요.

예시 (Examples)

resize-handle slot 안에서

이 컴포넌트는 resizable prop이 설정되면 자동으로 표시되지만, DashboardSidebar와 DashboardPanel 컴포넌트의 resize-handle slot을 사용하면 핸들을 커스터마이즈할 수 있어요.

<template>
  <UDashboardGroup>
    <UDashboardSidebar resizable>
      <template #resize-handle="{ onMouseDown, onTouchStart, onDoubleClick }">
        <UDashboardResizeHandle
          class="after:absolute after:inset-y-0 after:right-0 after:w-px hover:after:bg-(--ui-border-accented) after:transition"
          @mousedown="onMouseDown"
          @touchstart="onTouchStart"
          @dblclick="onDoubleClick"
        />
      </template>
    </UDashboardSidebar>

    <slot />
  </UDashboardGroup>
</template>
<script setup lang="ts">
definePageMeta({
  layout: 'dashboard'
})
</script>

<template>
  <UDashboardPanel resizable>
    <template #resize-handle="{ onMouseDown, onTouchStart, onDoubleClick }">
      <UDashboardResizeHandle
        class="after:absolute after:inset-y-0 after:right-0 after:w-px hover:after:bg-(--ui-border-accented) after:transition"
        @mousedown="onMouseDown"
        @touchstart="onTouchStart"
        @dblclick="onDoubleClick"
      />
    </template>
  </UDashboardPanel>
</template>

[!NOTE]

이 예시에서는 after 의사 요소를 추가해서 호버 시 세로 줄이 표시되도록 했어요.

API

Props

/**
 * Props for the DashboardResizeHandle component
 */
interface DashboardResizeHandleProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  ui?: { base?: any; } | undefined;
}

Slots

/**
 * Slots for the DashboardResizeHandle component
 */
interface DashboardResizeHandleSlots {
  default(): any;
}

테마 (Theme)

export default defineAppConfig({
  ui: {
    dashboardResizeHandle: {
      base: 'hidden lg:block touch-none select-none cursor-ew-resize relative before:absolute before:inset-y-0 before:-left-1.5 before:-right-1.5 before:z-1'
    }
  }
})

더 알아보기 (Learn more)