Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
Advanced settings
Settings most people never change stay hidden.
Webhook settings
CollapsibleAdvanced.vue
<script setup lang="ts">
import { ChevronDown } from '@lucide/vue'
import { ref } from 'vue'
import { Button } from '@/components/ui/button'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
const open = ref(false)
const fields = [
{ label: 'API version', value: 'v2' },
{ label: 'Timeout', value: '30 s' },
{ label: 'Retries', value: '3' },
]
</script>
<template>
<!-- The trigger is a Button (as-child), so it has the Button look and focus ring. Its label says what opens. -->
<Collapsible v-model:open="open" class="flex w-full max-w-80 flex-col gap-(--bh-space-100) [font:var(--bh-font-body-default)]">
<div class="flex items-center justify-between gap-(--bh-space-100) text-(--bh-color-text)">
<span>Webhook settings</span>
<CollapsibleTrigger as-child>
<Button variant="ghost" size="sm">
{{ open ? 'Hide advanced' : 'Show advanced' }}
<ChevronDown :class="open ? 'rotate-180' : ''" />
</Button>
</CollapsibleTrigger>
</div>
<CollapsibleContent>
<dl class="m-0 grid grid-cols-[1fr_auto] gap-x-(--bh-space-200) gap-y-(--bh-space-050) rounded-(--bh-radius-card) bg-(--bh-color-surface-subtle) p-(--bh-space-150)">
<template v-for="field in fields" :key="field.label">
<dt class="text-(--bh-color-text-subtle)">{{ field.label }}</dt>
<dd class="m-0 text-end text-(--bh-color-text)">{{ field.value }}</dd>
</template>
</dl>
</CollapsibleContent>
</Collapsible>
</template>A long log
The first lines show; the rest opens on request.
Order sync failed at 09:30.
CollapsibleLog.vue
<script setup lang="ts">
import { CircleAlert } from '@lucide/vue'
import { Button } from '@/components/ui/button'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
const lines = [
'09:30:02 Connecting to ERP',
'09:30:05 Sending 12 orders',
'09:30:06 ERP answered 401: API key rejected',
]
</script>
<template>
<Collapsible v-slot="{ open }" class="flex w-full max-w-120 flex-col gap-(--bh-space-100) [font:var(--bh-font-body-default)]">
<div class="flex items-center gap-(--bh-space-100) text-(--bh-color-text)">
<CircleAlert class="size-(--bh-size-icon-default) shrink-0 text-(--bh-color-icon-danger)" aria-hidden="true" />
<span class="flex-1">Order sync failed at 09:30.</span>
<CollapsibleTrigger as-child>
<Button variant="link">{{ open ? 'Hide log' : 'Show log' }}</Button>
</CollapsibleTrigger>
</div>
<CollapsibleContent>
<pre class="m-0 overflow-x-auto rounded-(--bh-radius-card) bg-(--bh-color-surface-subtle) p-(--bh-space-150) text-(--bh-color-text) [font:var(--bh-font-code-default)]">{{ lines.join('\n') }}</pre>
</CollapsibleContent>
</Collapsible>
</template>