SidebarTrigger.vue 657 B

123456789101112131415161718192021222324252627
  1. <script setup lang="ts">
  2. import type { HTMLAttributes } from "vue"
  3. import { PanelLeft } from "lucide-vue-next"
  4. import { cn } from '@/Packages/Shadcn/Lib/utils'
  5. import { Button } from '@/Packages/Shadcn/Components/ui/button'
  6. import { useSidebar } from "./utils"
  7. const props = defineProps<{
  8. class?: HTMLAttributes["class"]
  9. }>()
  10. const { toggleSidebar } = useSidebar()
  11. </script>
  12. <template>
  13. <Button
  14. data-sidebar="trigger"
  15. data-slot="sidebar-trigger"
  16. variant="ghost"
  17. size="icon"
  18. :class="cn('h-7 w-7', props.class)"
  19. @click="toggleSidebar"
  20. >
  21. <PanelLeft />
  22. <span class="sr-only">Toggle Sidebar</span>
  23. </Button>
  24. </template>