Skip to content

Installation

Getting Started: This Page · Quick Start · Configuration

Alap is a single package with zero required dependencies. Framework adapters are included but only activate when you import them — bring your own framework.

Live version with interactive examples: https://docs.alap.info/getting-started/installation

npm

bash
npm install alap

What you get

Import pathWhat it gives youPeer dependencies
alapEverything: engine, menus, lightbox, lens, embed, all protocols, coordinatorsNone
alap/slimEngine + menus (DOM + WC) + web/json protocols + coordinatorNone
alap/coreEngine + parser only (no DOM)None
alap/react<AlapProvider>, <AlapLink>, useAlap()react, react-dom
alap/vue<AlapProvider>, <AlapLink>, useAlap()vue
alap/svelte<AlapProvider>, <AlapLink>, useAlap()svelte
alap/solidAlapProvider, AlapLink, useAlap()solid-js
alap/astroAlapLink.astro, AlapSetup.astroastro
alap/alpinealapPlugin, x-alap directivealpinejs
alap/qwikAlapProvider, AlapLink, useAlap()@builder.io/qwik
alap/storageIndexedDB + Remote + Hybrid persistenceidb (optional)

Framework adapters are just the adapter. Paths like alap/react or alap/vue export only the Provider, Link component, and composable/hook — they don't re-export the engine, lightbox, lens, protocols, or anything else. The Provider creates an engine internally, so basic menu usage works with just the adapter import. But if you need a renderer or protocol alongside framework components, import it from alap separately:

tsx
import { AlapProvider, AlapLink } from 'alap/vue';   // adapter only
import { AlapLightbox } from 'alap';                  // renderer from main package

CSS files for renderers are imported separately:

Import pathWhat it styles
alap/lightbox.cssLightbox overlay, image zoom, set navigation
alap/lens.cssLens panel, tags, metadata layout
alap/embed.cssEmbed iframes, consent prompt
alap/transitions.cssShared renderer transition animations

Your bundler tree-shakes everything you don't import. Start with alap/slim for the lightest footprint and upgrade to alap when you need renderers.

CDN (no build step)

No npm, no bundler. Load the IIFE build from a CDN or local file:

html
<script src="https://cdn.jsdelivr.net/npm/alap@3/dist/alap.iife.js"></script>

For renderer CSS, add stylesheet links:

html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alap@3/dist/lightbox.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/alap@3/dist/lens.css">

What's on window.Alap:

ExportWhat
defineAlapLink()Register the <alap-link> custom element
defineAlapLightbox()Register the <alap-lightbox> custom element
defineAlapLens()Register the <alap-lens> custom element
registerConfig(config, name?)Feed a config to the web component registry
updateRegisteredConfig(config, name?)Update a previously registered config
AlapLinkElementMenu web component class
AlapLightboxElementLightbox web component class
AlapLensElementLens web component class
AlapUIDOM menu adapter — new AlapUI(config)
AlapLightboxDOM lightbox — new AlapLightbox(config)
AlapLensDOM lens — new AlapLens(config)
AlapEngineProgrammatic engine — new AlapEngine(config)
RendererCoordinatorOrchestrate transitions between renderers
getInstanceCoordinator()Cross-instance menu dismiss coordinator
validateConfig(raw)Sanitize untrusted configs
mergeConfigs(...configs)Compose multiple configs into one
webHandler, jsonHandler, atprotoHandlerBuilt-in protocol handlers
ProtocolCacheCache for protocol results
createEmbed, grantConsent, revokeConsentEmbed iframe rendering + consent

Size: 142 KB (35.5 KB gzipped) — the full build with all renderers, protocols, and coordinators.

Works with static HTML, WordPress, Drupal, Shopify, GitHub Pages, Hugo, Jekyll, CodePen — anywhere you can add a <script> tag.

Peer dependencies

Install only the ones for your framework:

bash
npm install react react-dom    # for alap/react
npm install vue                # for alap/vue
npm install svelte             # for alap/svelte
npm install solid-js           # for alap/solid
npm install idb                # for alap/storage (IndexedDB only)

All peer dependencies are optional. If you import an adapter without its framework, you get a clear error telling you what to install.

Environment compatibility

ImportBrowserNode.jsNotes
alap/coreYesYesPure logic, zero DOM references
alap/slimYesNoMenus use DOM APIs
alapYesNoRenderers and web components use DOM APIs
alap/reactYesSSR*Needs React DOM
alap/vueYesSSR*Needs Vue runtime
alap/svelteYesSSR*Needs Svelte runtime
alap/solidYesSSR*Needs SolidJS runtime
alap/alpineYesNoNeeds document
alap/qwikYesSSR*Needs Qwik runtime
alap/astroYesYesThin wrapper
alap/storageYesPartial**IndexedDB needs browser; RemoteStore works anywhere

* Framework adapters work in SSR contexts (Next.js, Nuxt, SvelteKit) where the framework provides its own server-side DOM abstraction.

** createRemoteStore() works in Node.js (uses fetch). createIndexedDBStore() requires a browser.

Plugins & Integrations

Separate packages for specific platforms and content pipelines. Available in the Alap monorepo under plugins/ and integrations/. To use them, clone the repo and reference them via pnpm workspace.

PackageWhat
remark-alapMarkdown → <alap-link> (workspace)
rehype-alapHTML/CMS content → <alap-link> (workspace)
@alap/mdxMDX with React provider (workspace)
@alap/tiptapTiptap/ProseMirror extension (workspace)
astro-alapAstro integration (zero-config) (workspace)
eleventy-alapEleventy plugin (shortcodes + filters) (workspace)
qwik-alapQwik City integration (Vite plugin) (workspace)
next-alapNext.js App Router ('use client' + layout) (workspace)
nuxt-alapNuxt 3 (client plugin + Nuxt Content) (workspace)
vitepress-alapVitePress (Vite plugin + custom element) (workspace)

For WordPress, see the WordPress plugin (no npm — PHP plugin with Docker containers). For Hugo, see the Hugo integration (shortcodes + web component).

For contributors

bash
git clone <repo>
cd alap
pnpm install    # installs everything needed for development
pnpm test       # runs all tests across core, UI, and storage