DashboardToolbar
대시보드 내비바 아래에 표시하는 툴바 컴포넌트예요. DashboardNavbar 컴포넌트 아래에 놓아서 왼쪽·중앙·오른쪽 슬롯으로 구성할 수 있어요.
출처: Nuxt UI
본문
대시보드 내비바 아래에 표시하는 툴바 컴포넌트예요.
사용법
DashboardToolbar 컴포넌트는 DashboardNavbar 컴포넌트 아래에 툴바를 표시할 때 사용해요.
DashboardPanel 컴포넌트의 header 슬롯 안에 넣으면 돼요:
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
})
</script>
<template>
<UDashboardPanel>
<template #header>
<UDashboardNavbar />
<UDashboardToolbar />
</template>
</UDashboardPanel>
</template>
left, default, right 슬롯으로 툴바를 커스터마이징할 수 있어요.
<script setup lang="ts">
import type { NavigationMenuItem } from '@nuxt/ui'
const items: NavigationMenuItem[][] = [[{
label: 'General',
icon: 'i-lucide-user',
active: true
}, {
label: 'Members',
icon: 'i-lucide-users'
}, {
label: 'Notifications',
icon: 'i-lucide-bell'
}], [{
label: 'Documentation',
icon: 'i-lucide-book-open',
to: 'https://ui.nuxt.com/docs',
target: '_blank'
}, {
label: 'Help & Feedback',
icon: 'i-lucide-help-circle',
to: 'https://github.com/nuxt/ui/issues',
target: '_blank'
}]]
</script>
<template>
<UDashboardToolbar>
<UNavigationMenu :items="items" highlight class="flex-1" />
</UDashboardToolbar>
</template>
[!NOTE]
In this example, we use the NavigationMenu component to render some links.
이 예시에서는 NavigationMenu 컴포넌트로 링크들을 렌더링하고 있어요.
API
Props
/**
* Props for the DashboardToolbar component
*/
interface DashboardToolbarProps {
/**
* The element or component this component should render as.
* @default 'div'
*/
as?: any;
ui?: { root?: SlotClass; left?: SlotClass; right?: SlotClass; } | undefined;
}
Slots
/**
* Slots for the DashboardToolbar component
*/
interface DashboardToolbarSlots {
default(): any;
left(): any;
right(): any;
}
테마 (Theme)
export default defineAppConfig({
ui: {
dashboardToolbar: {
slots: {
root: 'shrink-0 flex items-center justify-between border-b border-default px-4 sm:px-6 gap-1.5 overflow-x-auto min-h-[49px]',
left: 'flex items-center gap-1.5',
right: 'flex items-center gap-1.5'
}
}
}
})