<sessions-disclosure>
A row that expands to reveal its children.
Preact & React
<Disclosure>GroupActionsDrawn asDisclosurePreview
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
titlerequiredThe row title.Prop
titlesubtitleA secondary line under the title.Prop
subtitleopenbooleanWhether the content is revealed.Prop
openEvents
toggledetail: undefinedThe header was pressed.Prop
onToggleSlots
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
<sessions-button>A button, or a link styled as one when to is set.<sessions-banner>A callout with a heading and a body.<sessions-badge>A small status label.<sessions-image>An image with an accessible description.<sessions-embed>A Spotify, Apple Music or YouTube player in a sandboxed frame.<sessions-disclosure-group>Stacks sessions-disclosure rows with dividers between them.