Skip to content

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 localStorage on first mount: opens automatically unless dismissed before, then records the dismissal
  • The host can also control visibility with the open attribute (controlled overrides auto); auto="false" disables auto-open
  • storage-key names the memory entry (default oas-curtain); instances share state per key
  • persist="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)

Open curtainClear memoryMemory: not dismissed

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.

Open mask-closable curtain

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.

Open non-persistent curtain

Methods ​

See the "Methods" table in the API section below (show / close / reset).

API ​

oas-curtain ​

Attributes ​

AttributeDescriptionTypeDefault
autoAuto-open switch: absent = auto-detect; "false" disables auto-open (manual control in docs/embeds)string—
headingHeading; empty by default — use the default slot for custom contentstring—
mask-closableBoolean; when present, clicking the mask outside the panel closes it (by default only the close button / Esc)——
openControlled visibility (present = open; controlled overrides auto-detection)——
persistValue boolean: absent/any non-"false" = remember dismissal; "false" = no local memory, opens every timestring—
storage-keyLocal memory key (default oas-curtain); instances share the dismissed state per keystring—

Methods ​

MethodSignatureDescription
showshow(): voidForce open (does not clear local memory)
closeclose(reason: CloseReason): voidClose and write local memory (when persist applies), dispatching oas-close
resetreset(): voidClear local memory (does not change current visibility)

Events ​

EventDescription
oas-closeDispatched on close (reason: button / esc / backdrop / api)

Slots ​

NameDescription
defaultCurtain body content

CSS Variables ​

CSS VariableDescriptionDefault
--oas-curtain-bgFull-screen backgroundvar(--oas-color-bg)
--oas-curtain-colorText colorvar(--oas-color-text-primary)
--oas-curtain-durationFade-in durationvar(--oas-transition-base)
--oas-curtain-max-widthContent card max width420px
--oas-curtain-panel-bgContent card backgroundvar(--oas-color-bg-elevated)

Released under the MIT OR Apache-2.0 License.