Optional details
Hide secondary metadata until someone asks to inspect it.
Components / Layout
A controlled or uncontrolled disclosure region with native trigger semantics.
Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.
bunx --bun @getweini/cli@latest add collapsibleImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
Owner: Ana Martins
Status: In review
<script setup lang="ts">
import Collapsible from './components/ui/collapsible/Collapsible.vue'
import CollapsibleContent from './components/ui/collapsible/CollapsibleContent.vue'
import CollapsibleTrigger from './components/ui/collapsible/CollapsibleTrigger.vue'
</script>
<template>
<Collapsible default-open>
<CollapsibleTrigger v-slot="{ open }">
<span class="inline-flex items-center gap-2">
Project details
<svg
aria-hidden="true"
viewBox="0 0 16 16"
class="ui-motion size-4 fill-none stroke-current"
:class="{ 'rotate-180': open }"
>
<path d="m4 6 4 4 4-4" stroke-width="1.5" stroke-linecap="round" />
</svg>
</span>
</CollapsibleTrigger>
<CollapsibleContent>
<p>Owner: Ana Martins</p>
<p>Status: In review</p>
</CollapsibleContent>
</Collapsible>
</template>Trigger and content have stable ARIA relationships. Closed content remains inert and the transition respects reduced motion.
Hide secondary metadata until someone asks to inspect it.
Let readers open advanced filters without leaving the page.
Use the default-open state for information that usually matters.
<script setup lang="ts">
import Collapsible from './components/ui/collapsible/Collapsible.vue'
import CollapsibleContent from './components/ui/collapsible/CollapsibleContent.vue'
import CollapsibleTrigger from './components/ui/collapsible/CollapsibleTrigger.vue'
</script>
<template>
<Collapsible default-open>
<CollapsibleTrigger>Project details</CollapsibleTrigger>
<CollapsibleContent>
<p>Owner: Ana Martins</p>
<p>Status: In review</p>
</CollapsibleContent>
</Collapsible>
</template>Use the open model when another control also changes disclosure state.
<script setup lang="ts">
import { ref } from 'vue'
import Collapsible from './components/ui/collapsible/Collapsible.vue'
import CollapsibleContent from './components/ui/collapsible/CollapsibleContent.vue'
import CollapsibleTrigger from './components/ui/collapsible/CollapsibleTrigger.vue'
const open = ref(false)
</script>
<template>
<Collapsible v-model:open="open">
<CollapsibleTrigger>Advanced filters</CollapsibleTrigger>
<CollapsibleContent>
<label>Owner <input name="owner"></label>
</CollapsibleContent>
</Collapsible>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
openmodel | boolean | undefined | Not set | Current open state. Use v-model:open to keep it in sync with your page. |
defaultOpenprop | boolean | undefined | false | Starting open state when the parent does not control open. |
disabledprop | boolean | undefined | false | Prevent interaction and show the disabled state. |
update:openevent | [open: boolean] | — | Requests a new open value from the parent. |
openChangeevent | [open: boolean] | — | Emitted after this value or state changes. |
defaultslot | (props: { open: boolean; setOpen: (open: boolean) => void; }) => unknown | Required | Content shown inside Collapsible. |
openexposed | () => void | — | Open this component from application code. |
closeexposed | () => void | — | Close this component from application code. |
toggleexposed | () => void | — | Access toggle from a component template ref. |
focusexposed | () => void | undefined | — | Move keyboard focus to this control. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | (props: { open: boolean; }) => unknown | Required | Content shown inside CollapsibleContent. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
disabledprop | boolean | undefined | false | Prevent interaction and show the disabled state. |
asChildprop | boolean | undefined | Not set | Use one child element as the control instead of adding another wrapper. |
defaultslot | (props: { open: boolean; }) => unknown | Required | Content shown inside CollapsibleTrigger. |
// packages/frameworks/vue/components/collapsible/types.ts
// ------- TYPES -------
export interface CollapsibleProps {
open?: boolean
defaultOpen?: boolean
disabled?: boolean
}
export interface CollapsibleTriggerProps {
disabled?: boolean
asChild?: boolean
}