Skip to content

<sessions-disclosure>

A row that expands to reveal its children.

Preact & React<Disclosure>GroupActionsDrawn asDisclosure

Preview

Drawn by the same renderers Sessions uses for your extension, from the DOM example beside it, without its event handlers.

When to use it

Keep the open attribute in your own state and toggle it in the toggle handler. A media child (a small sessions-image) leads the row; an accessory child (an sessions-switch) sits at its end, in place of the expand chevron.

In Preact and React, import the component of the same name from @sessions/apps/preact or @sessions/apps/react. Attributes become camelCase props, a boolean attribute is a boolean prop, and an event is an on prop that receives the event’s detail.

Attributes

Attribute
titlerequired
The row title.Prop title
subtitle
A secondary line under the title.Prop subtitle
openboolean
Whether the content is revealed.Prop open

Events

toggledetail: undefined
The header was pressed.Prop onToggle

Slots

slot="media"
A logo or icon at the start of the row, drawn at 24px.
slot="accessory"
A control at the end of the row, operated independently of the toggle.
Example
import {
  Disclosure,
  Image,
  Switch,
  Text,
} from '@sessions/apps/preact';

<Disclosure
  title="Spotify"
  subtitle="Connected"
  open={model.expanded === 'spotify'}
  onToggle={() => model.toggle('spotify')}
>
  <Image slot="media" src="https://example.com/spotify.png" alt="Spotify" />
  <Switch slot="accessory" checked={model.connected} onChange={(on) => model.connect(on)} />
  <Text>1. Opener · 2. Deep cut · 3. Encore</Text>
</Disclosure>

In the same group