Skip to content
Focsd homeFocsd homeFocsd
Forms

Disclosure

A button that shows and hides one block of content.

  • Tag: focsd-disclosure
  • Pattern: Disclosure (details)
  • Category: Disclosure

Example

Webhook retries: 3

HTML
<focsd-disclosure summary="Show advanced options"
><p>Webhook retries: 3</p></focsd-disclosure
>

Usage

Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.

<script type="module">
import '@focsd-dev/components/focsd-disclosure.js';
</script>
<focsd-disclosure summary="Show advanced options">…</focsd-disclosure>

API

Attributes

AttributePropertyTypeDefault
summarysummarystring—
openopenbooleanfalse
disableddisabledbooleanfalse
namenamestring—

Methods

MethodDescription
toggle()Open or close the panel (does nothing while disabled); toggle fires once it has.

Events

EventDescription
toggleFired when the element opens or closes. Like <details>, it does not bubble.

Slots

SlotDescription
(default)Default content.
iconReplaces the expand indicator (keep it decorative).

CSS parts

Style the inside of the component with ::part(), for example focsd-disclosure::part(icon).

PartDescription
iconThe icon element.
panelThe panel element.
triggerThe trigger element.

Accessibility

  • name makes disclosures in the same tree an exclusive group: opening one closes the others, like <details name>.
  • A <button aria-expanded aria-controls> and its panel in one shadow root.
  • Fires toggle when it opens or closes.

Keyboard

KeyAction
Enter / SpaceToggle