O componente DashboardSidebarToggle é usado pelos componentes DashboardNavbar e DashboardSidebar.
Ele é exibido automaticamente no mobile para abrir e fechar a sidebar, você não precisa adicioná-lo manualmente.
<template>
<NDashboardSidebarToggle />
</template>
Ele estende o componente Button, então você pode passar qualquer propriedade como color, variant, size, etc.
<template>
<NDashboardSidebarToggle variant="subtle" />
</template>
color="neutral" e variant="ghost".toggleEmbora este componente seja exibido automaticamente no mobile, você pode usar o slot toggle dos componentes DashboardNavbar e DashboardSidebar para personalizar o botão.
<template>
<NDashboardGroup>
<NDashboardSidebar>
<template #toggle>
<NDashboardSidebarToggle variant="subtle" />
</template>
</NDashboardSidebar>
<slot />
</NDashboardGroup>
</template>
<script setup lang="ts">
definePageMeta({
layout: 'dashboard'
})
</script>
<template>
<NDashboardPanel>
<template #header>
<NDashboardNavbar title="Home">
<template #toggle>
<NDashboardSidebarToggle variant="subtle" />
</template>
</NDashboardNavbar>
</template>
</NDashboardPanel>
</template>
toggle-side dos componentes DashboardSidebar e DashboardNavbar, o botão será exibido no lado especificado.| Prop | Default | Type |
|---|---|---|
as | 'button' | anyThe element or component this component should render as when not a link. |
color | 'neutral' | "error" | "neutral" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" |
variant | 'ghost' | "ghost" | "solid" | "outline" | "soft" | "subtle" | "link" |
side | 'left' | "left" | "right"The side of the sidebar to toggle. |
autofocus | false | true | "true" | "false" | |
disabled | boolean | |
name | string | |
type | 'button' | "reset" | "submit" | "button"The type of the button when not a link. |
label | string | |
activeColor | "error" | "neutral" | "primary" | "secondary" | "accent" | "success" | "info" | "warning" | |
activeVariant | "ghost" | "solid" | "outline" | "soft" | "subtle" | "link" | |
size | 'md' | "xs" | "sm" | "md" | "lg" | "xl" |
square | boolean Render the button with equal padding on all sides. | |
block | boolean Render the button full width. | |
loadingAuto | boolean Set loading state automatically based on the | |
icon | anyDisplay an icon based on the | |
avatar | AvatarPropsDisplay an avatar on the left side. | |
leading | boolean When | |
leadingIcon | anyDisplay an icon on the left side. | |
trailing | boolean When | |
trailingIcon | anyDisplay an icon on the right side. | |
loading | boolean When | |
loadingIcon | appConfig.ui.icons.loading | anyThe icon when the |
ui | { base?: any; } |
export default defineAppConfig({
ui: {
dashboardSidebarToggle: {
base: 'lg:hidden',
variants: {
side: {
left: '',
right: ''
}
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ui from '@nitro/ui/vite'
export default defineConfig({
plugins: [
vue(),
ui({
ui: {
dashboardSidebarToggle: {
base: 'lg:hidden',
variants: {
side: {
left: '',
right: ''
}
}
}
}
})
]
})