docs/.vitepress/theme/components/Collapsible.vue

d988ee066bb4fe0f5911b5c423254f9eaaab5419
wotaku/docs/.vitepress/theme/components/Collapsible.vue
Duck Odyssey304ac1badc 6 months ago

40 lines · 777 bytes

 1<script setup lang="ts">
 2import { ref } from 'vue'
 3
 4const props = defineProps<{
 5  title?: string
 6}>()
 7
 8const open = ref(false)
 9</script>
10
11<template>
12  <details class="details custom-block" :open="open || undefined" @toggle="open = ($event.target as HTMLDetailsElement).open">
13    <summary>
14      <span v-if="open" class="i-iconoir-nav-arrow-down collapsible-icon" />
15      <span v-else class="i-iconoir-nav-arrow-right collapsible-icon" />
16      {{ title || 'Details' }}
17    </summary>
18    <slot />
19  </details>
20</template>
21
22<style scoped>
23summary {
24  list-style: none;
25  display: flex;
26  align-items: center;
27  gap: 0.4em;
28  cursor: pointer;
29}
30
31summary::-webkit-details-marker {
32  display: none;
33}
34
35.collapsible-icon {
36  width: 1em;
37  height: 1em;
38  flex-shrink: 0;
39}
40</style>
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form