ShareSheet
A share panel that rises from the bottom: heading + channel grid + cancel button. Channels are declared through the channels JSON attribute ([{ key, name, icon? }]); icon is an oas-icon name (built-in or host-registered). Clicking a channel dispatches oas-select and closes the panel automatically.
- The
openattribute is controlled;show()/close()offer programmatic control - Heading / cancel / close copy comes from i18n and can be overridden with
heading/cancel-text - Opening moves focus to the first channel; Tab cycles inside the panel, Esc closes, and focus returns to the previously focused element
role="dialog"+aria-modal="true", with the heading as the accessible name
Basic Usage
Open via button (with channel / close feedback)
Custom Heading / Cancel Text
description renders a descriptive line under the heading (share notes and the like); it is not rendered by default:
heading / description / cancel-text overrides
Channel Descriptions
channels[].description renders a small description under each channel name (what the channel does); it is not rendered by default:
channels[].description
Channels Without Icons
When icon is missing, the first character of the name is used as a placeholder — handy for channels whose icons are not registered:
No icon → initial placeholder
Events
oas-select (detail { key, name, channel }) fires when a channel is clicked; oas-close (detail { reason, key? }) fires on close, where reason is select / cancel / close / backdrop / esc / api.
sheet.addEventListener('oas-select', (e) => console.info(e.detail.key))
sheet.addEventListener('oas-close', (e) => console.info(e.detail.reason))API
oas-share-sheet
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
cancel-text | Cancel button copy; defaults to i18n shareSheet.cancel | string | — |
channels | Channel JSON array [{ key, name, icon? }]: icon is an oas-icon name; missing icons fall back to the first character; invalid JSON is ignored with one dev warning | ShareSheetChannel[] | string | — |
description | Descriptive line under the heading (share notes and the like; not rendered by default) | string | — |
heading | Panel heading; defaults to i18n shareSheet.title | string | — |
open | Controlled visibility (present = open; host writes are silent) | — | — |
Property (JS property; see each row for attribute reflection)
| Property | Description | Type | Default |
|---|---|---|---|
channels | Channel list (property channel): equals the parsed channels attribute; assigning an array serializes and reflects it back to the attribute | ShareSheetChannel[] | string | — |
Methods
| Method | Signature | Description |
|---|---|---|
show | show(): void | Open the sheet (writes the open attribute) |
close | close(reason: CloseReason): void | Close the sheet and dispatch oas-close (reason defaults to api) |
Events
| Event | Description |
|---|---|
oas-close | Dispatched on close (reason: select / cancel / close / backdrop / esc / api), detail: key === undefined ? { reason } : { reason, key } |
oas-select | Dispatched when a channel is clicked; the sheet then closes automatically, detail: { key: channel.key, name: channel.name, channel } |
CSS Variables
| CSS Variable | Description | Default |
|---|---|---|
--oas-share-sheet-bg | Panel background | var(--oas-color-bg) |
--oas-share-sheet-channel-bg | Channel icon background | var(--oas-color-bg-elevated) |
--oas-share-sheet-channel-color | Channel icon foreground | var(--oas-color-text-primary) |
--oas-share-sheet-color | Panel text color | var(--oas-color-text-primary) |
--oas-share-sheet-columns | Grid column count | 4 |
--oas-share-sheet-mask | Mask color | var(--oas-color-overlay) |
--oas-share-sheet-max-height | Panel max height | 80vh |