Components
An extension renders with a small set of sessions-* elements. Each is drawn by the Sessions design system on the host, so it looks native on every brand, in light and dark, in the admin and on a business’s own site.
Using the elements
Use the Preact or React components, or build a tree yourself with the html tagged template from @sessions/apps or plain DOM APIs — document.createElement("sessions-button") works.
Every element is configured through attributes (strings; a boolean attribute is on when present). The components take the same attributes as camelCase props.
Listen with addEventListener, an on<event> property in html, or an on prop on a component. A form element reports its new value in the event’s detail.
Some elements have named slots: a child with slot="media", slot="accessory" or slot="icon" is drawn in that place rather than in the body.
sessions-* element is ignored by the host. There is no styling API on purpose: the host chooses colours, spacing and fonts so an extension always passes the brand’s contrast and matches its corners.import {Section, Badge, Stack, Text} from '@sessions/apps/preact';
<Section heading="Set list">
<Badge slot="action" tone="positive">Live</Badge>
<Stack gap="small">
<Text>1. Opener</Text>
<Text>2. Encore</Text>
</Stack>
</Section>Layout
Typography
Actions
<sessions-button>A button, or a link styled as one when to is set.<Button><sessions-banner>A callout with a heading and a body.<Banner><sessions-badge>A small status label.<Badge><sessions-image>An image with an accessible description.<Image><sessions-embed>A Spotify, Apple Music or YouTube player in a sandboxed frame.<Embed><sessions-disclosure-group>Stacks sessions-disclosure rows with dividers between them.<DisclosureGroup><sessions-disclosure>A row that expands to reveal its children.<Disclosure>Forms
<sessions-text-field>A single-line (or multiline) text input.<TextField><sessions-form>Fields saved together, with the host’s Save.<Form><sessions-select>A dropdown of sessions-option children.<Select><sessions-option>One choice in an sessions-select.<Option><sessions-switch>An on/off toggle with a label.<Switch>