Skip to content

<sessions-select>

A dropdown of sessions-option children.

Preact & React<Select>GroupFormsDrawn asSelect

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

Each sessions-option names a value; its text is the label.

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
label
The field label.Prop label
value
The selected value.Prop value
help-text
Guidance under the field.Prop helpText
error
A validation message.Prop error
disabledboolean
Non-interactive.Prop disabled

Events

changedetail: string — the new value
A different option was chosen.Prop onChange
Example
import {Select, Option} from '@sessions/apps/preact';

<Select label="Service" value={service} onChange={(value) => setService(value)}>
  <Option value="spotify">Spotify</Option>
  <Option value="appleMusic">Apple Music</Option>
</Select>

In the same group