Disclosure
Reveal optional content from a single persistent trigger.
Usage
Closed
Start closed and open only from the associated trigger.
Start closed and open only from the associated trigger.
<!-- Disclosure / Closed -->
<script setup lang="ts">
import { DisclosureContent, DisclosureRoot, DisclosureTrigger } from '@sectile/vue/disclosure'
</script>
<template>
<DisclosureRoot :default-value="false">
<DisclosureTrigger>Advanced options</DisclosureTrigger>
<DisclosureContent>Configuration</DisclosureContent>
</DisclosureRoot>
</template>Open
Start open so focus, dismissal, and overlay placement can be inspected immediately.
Start open so focus, dismissal, and overlay placement can be inspected immediately.
<!-- Disclosure / Open -->
<script setup lang="ts">
import { DisclosureContent, DisclosureRoot, DisclosureTrigger } from '@sectile/vue/disclosure'
</script>
<template>
<DisclosureRoot :default-value="false">
<DisclosureTrigger>Advanced options</DisclosureTrigger>
<DisclosureContent>Configuration</DisclosureContent>
</DisclosureRoot>
</template>Controlled
Let the parent own the current value and apply accepted changes back to the component.
Let the parent own the current value and apply accepted changes back to the component.
<!-- Disclosure / Controlled -->
<script setup lang="ts">
import { DisclosureContent, DisclosureRoot, DisclosureTrigger } from '@sectile/vue/disclosure'
</script>
<template>
<DisclosureRoot :default-value="false">
<DisclosureTrigger>Advanced options</DisclosureTrigger>
<DisclosureContent>Configuration</DisclosureContent>
</DisclosureRoot>
</template>API
Vue package: @sectile/vue/disclosure
DisclosureRootDisclosureTriggerDisclosureContent
Props
DisclosureRootProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
contentIdID of the content controlled by this trigger.
defaultValueInitial value used when the component owns its state.
disabledWhether interaction is unavailable.
modelValueCurrent value when state is controlled by the parent.
readonlyWhether the value can be inspected but not changed.
DisclosureTriggerProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
DisclosureContentProps
asElement or component rendered for this part.
asChildWhether to merge this part into its single child instead of rendering a wrapper.
Slots
DisclosureSlotProps
disabledWhether interaction is unavailable.
openWhether the associated popup or disclosure is open.
readonlyWhether the value can be inspected but not changed.
Events
DisclosureRoot
update:modelValueEmitted when the component requests a new controlled value.
Other types
DisclosureValueChangeHandler
type DisclosureValueChangeHandler = (value: boolean) => voidParts
Shared scope: [data-scope="disclosure"]. Combine it with a part selector to keep styles local to this component.
| Part | Selector | Role | Extra attributes |
|---|---|---|---|
root | [data-part="root"] | Defines the component boundary and owns its composed parts. | — |
trigger | [data-part="trigger"] | Opens, closes, or activates the associated content. | — |
content | [data-part="content"] | Contains the component content shown for the active state. | — |
Keyboard interaction
| Key | Behavior |
|---|---|
| Enter / Space | Toggle the associated content. |
| Tab | Move between the trigger and surrounding controls. |
Accessibility
The trigger exposes expanded state and its relationship to the controlled content.
See the corresponding WAI-ARIA pattern for the host accessibility contract.
