DashboardToolbar
Une barre d
Utilisation
Le composant DashboardToolbar est utilisé pour afficher une barre d'outils sous le composant DashboardNavbar.
Utilisez-le à l'intérieur de l'emplacement header du composant DashboardPanel:
pages/index.vue
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
})
</script>
<template>
<UDashboardPanel>
<template #header>
<UDashboardNavbar />
<UDashboardToolbar />
</template>
</UDashboardPanel>
</template>
Utilisez les emplacements left, default et right pour personnaliser la barre d'outils.
<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>Dans cet exemple, nous utilisons le composant NavigationMenu pour rendre certains liens.
api
Props
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
ui | { root?: SlotClass; left?: SlotClass; right?: SlotClass; } |
Slots
| Slot | Type |
|---|---|
default | {} |
left | {} |
right | {} |
thème
app.config.ts
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'
}
}
}
})vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
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'
}
}
}
})
]
})xph05xChangelog
No recent changes