DashboardPanel 대시보드 패널
대시보드에 표시할 크기 조절 가능한 패널 컴포넌트예요. DashboardGroup 컴포넌트 안의 기본 슬롯에 넣어 여러 패널을 나란히 배치할 수 있어요.
출처: Nuxt UI
본문
대시보드에 표시할 크기 조절 가능한 패널이에요.
사용법 (Usage)
DashboardPanel 컴포넌트는 패널을 표시할 때 사용해요. 상태(크기, 접힘 여부 등)는 DashboardGroup 컴포넌트에 전달한 storage와 storage-key prop에 따라 저장돼요.
DashboardGroup 컴포넌트의 기본 슬롯 안에서 사용하세요. 여러 패널을 나란히 배치할 수 있어요.
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
})
</script>
<template>
<UDashboardPanel id="inbox-1" resizable />
<UDashboardPanel id="inbox-2" class="hidden lg:flex" />
</template>
[!CAUTION]
다른 페이지에서 여러 패널을 사용할 때는 충돌을 피하기 위해
id를 설정하는 것이 좋아요.
[!WARNING]
이 컴포넌트는
resizableprop 사용 시 단일 루트 요소가 없어요. 페이지 전환을 사용하거나 레이아웃을 위해 단일 루트가 필요하다면 컨테이너(예:<div class="flex flex-1">)로 감싸세요.
header, body, footer 슬롯을 이용해 패널을 커스터마이즈할 수 있고, 스크롤 가능한 본문과 패딩이 필요 없으면 기본 슬롯을 사용해요.
<template>
<UDashboardPanel resizable>
<template #header>
<UDashboardNavbar title="Inbox">
<template #leading>
<UDashboardSidebarCollapse />
</template>
</UDashboardNavbar>
</template>
<template #body>
<Placeholder class="h-full" />
</template>
</UDashboardPanel>
</template>
[!NOTE]
대부분
header슬롯에DashboardNavbar컴포넌트를 사용해요.
Resizable
resizable prop을 이용해 패널의 크기를 조절할 수 있게 할 수 있어요.
<template>
<UDashboardPanel resizable>
<template #body>
<Placeholder class="h-96" />
</template></UDashboardPanel>
</template>
Size
min-size, max-size, default-size prop을 이용해 패널의 크기를 커스터마이즈할 수 있어요.
<template>
<UDashboardPanel resizable :min-size="22" :default-size="35" :max-size="40">
<template #body>
<Placeholder class="h-96" />
</template></UDashboardPanel>
</template>
[!TIP] See: /docs/components/dashboard-group#props
크기는 기본적으로 백분율로 계산돼요.
DashboardGroup컴포넌트의unitprop으로 이를 바꿀 수 있어요.
API
Props
/**
* Props for the DashboardPanel component
*/
interface DashboardPanelProps {
ui?: { root?: SlotClass; body?: SlotClass; handle?: SlotClass; } | undefined;
/**
* The id of the panel.
* @default useId()
*/
id?: string | undefined;
/**
* The minimum size of the panel.
* @default 15
*/
minSize?: number | undefined;
/**
* The maximum size of the panel.
* @default 100
*/
maxSize?: number | undefined;
/**
* The default size of the panel.
* @default 0
*/
defaultSize?: number | undefined;
/**
* Whether to allow the user to resize the panel.
* @default false
*/
resizable?: boolean | undefined;
}
Slots
/**
* Slots for the DashboardPanel component
*/
interface DashboardPanelSlots {
default(): any;
header(): any;
body(): any;
footer(): any;
resize-handle(): any;
}
테마 (Theme)
export default defineAppConfig({
ui: {
dashboardPanel: {
slots: {
root: 'relative flex flex-col min-w-0 min-h-svh lg:not-last:border-e lg:not-last:border-default shrink-0',
body: 'flex flex-col gap-4 sm:gap-6 flex-1 overflow-y-auto p-4 sm:p-6',
handle: ''
},
variants: {
size: {
true: {
root: 'w-full lg:w-(--width)'
},
false: {
root: 'flex-1'
}
}
}
}
}
})