Curtain
A full-screen overlay shown once per visitor: it opens automatically on the first visit and writes a local memory when dismissed, so it does not bother the user again. Suitable for announcements, onboarding, and campaign popups that should interrupt only once.
- Reads
localStorageon first mount: opens automatically unless dismissed before, then records the dismissal - The host can also control visibility with the
openattribute (controlled overrides auto);auto="false"disables auto-open storage-keynames the memory entry (defaultoas-curtain); instances share state per keypersist="false"skips local memory (always opens);reset()clears the memory- Close paths: close button / Esc / clicking outside when
mask-closable;close()for programmatic control role="dialog"+aria-modal="true"; opening focuses the close button, Tab cycles inside the panel, and focus returns on close
Basic Usage
Open / clear memory (auto=false lets the docs trigger it manually)
This is a one-time curtain: dismissing it writes a local memory, so the next visit does not auto-open it.
Use the close button in the corner, or press Esc.
Auto-open (the real default)
Without auto="false" the curtain opens automatically on the first visit (guarded by local memory). The docs disable auto-open on every demo to avoid covering the page; the "Open curtain" button above shows the same state after a first auto-open.
Default auto: opens on real integration
Drop <oas-curtain> into a production page with no script; after one dismissal the local memory prevents it from opening again.
Click the Mask to Close
By default only the close button and Esc exit; mask-closable also allows clicking the mask outside the panel:
mask-closable
Clicking the empty area outside the card closes it.
No Local Memory
With persist="false" a dismissal writes nothing to localStorage (it opens every time) — suitable for announcements that need confirmation each visit:
persist=false
No local memory on close: reloading the page (or entering again) still opens it.
Methods
See the "Methods" table in the API section below (show / close / reset).
API
oas-curtain
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
auto | Auto-open switch: absent = auto-detect; "false" disables auto-open (manual control in docs/embeds) | string | — |
heading | Heading; empty by default — use the default slot for custom content | string | — |
mask-closable | Boolean; when present, clicking the mask outside the panel closes it (by default only the close button / Esc) | — | — |
open | Controlled visibility (present = open; controlled overrides auto-detection) | — | — |
persist | Value boolean: absent/any non-"false" = remember dismissal; "false" = no local memory, opens every time | string | — |
storage-key | Local memory key (default oas-curtain); instances share the dismissed state per key | string | — |
Methods
| Method | Signature | Description |
|---|---|---|
show | show(): void | Force open (does not clear local memory) |
close | close(reason: CloseReason): void | Close and write local memory (when persist applies), dispatching oas-close |
reset | reset(): void | Clear local memory (does not change current visibility) |
Events
| Event | Description |
|---|---|
oas-close | Dispatched on close (reason: button / esc / backdrop / api) |
Slots
| Name | Description |
|---|---|
| default | Curtain body content |
CSS Variables
| CSS Variable | Description | Default |
|---|---|---|
--oas-curtain-bg | Full-screen background | var(--oas-color-bg) |
--oas-curtain-color | Text color | var(--oas-color-text-primary) |
--oas-curtain-duration | Fade-in duration | var(--oas-transition-base) |
--oas-curtain-max-width | Content card max width | 420px |
--oas-curtain-panel-bg | Content card background | var(--oas-color-bg-elevated) |