Skip to content
Viewership Inquire
Astro UI

Overlay core.

Positioning, dismissal, focus-trap and roving-focus helpers for popovers, menus and dialogs.

OverlaysAtomNo dependencies Original, MIT

.md

Install

  1. Import the foundation once

    foundation.css holds the tokens every component reads.

    Layout.astro
    ---
    // src/layouts/Layout.astro
    import "../styles/foundation.css";
    ---
  2. Copy overlay.ts

    Paste into src/components/viewership/overlay/

Props 6

PropTypeDefaultDescription
computePosition(anchor, floating, opts) function · Places a fixed element beside its anchor with flip and shift.
autoUpdate(anchor, floating, update) function · Re-runs `update` on scroll and resize. Returns cleanup.
onDismiss(el, dismiss, opts) function · Escape, outside-pointer and focus-out dismissal. Returns cleanup.
trapFocus(container, opts) function · Contains Tab focus. Release restores prior focus.
rovingFocus(container, opts) function · Arrow/Home/End navigation with typeahead.
uid(prefix) function · Unique id for ARIA wiring.

Source 1 file

Original, MIT.