Developer docs

Install once. Configure everything.

One stylesheet, one script and one guarded call. Everything below is optional: the defaults are safe for any site, and every field is validated at runtime so a typo can never break your page.

Install

Add these lines before the closing </body> tag, or through your tag manager. Your siteId is registered the moment you check out, and your install kit shows the exact embed for each of your sites.

HTML
<link rel="stylesheet" href="https://cdn.nirvani.dev/access/v1/nirvani-access.css">
<script src="https://cdn.nirvani.dev/access/v1/nirvani-access.js" defer></script>
<script>
  window.addEventListener("DOMContentLoaded", function () {
    if (window.NirvaniAccess) window.NirvaniAccess.init({
      siteId: "acme-corp",
      brandName: "Acme Corp",
      brandTheme: "mint",
      position: "bottom-left",
      statementUrl: "/accessibility",
      privacyUrl: "/privacy"
    });
  });
</script>
  • Always guard the call. if (window.NirvaniAccess) means a blocked or unreachable CDN never throws on your page.
  • Use defer. The widget never blocks rendering and mounts after your content.
  • One siteId per site. Visitor preferences are stored per site under nirvani_access_v1_{siteId}.
  • Single-page apps. Call init once. If your app swaps the whole <body> (Turbo, pjax), call init again after each swap and the widget remounts cleanly.

Configuration

Pass any of these fields to init. Unknown or malformed values are dropped and the default applies.

Identity and placement

OptionTypeDefaultWhat it does
siteIdstring"default"Unique id for the site. Namespaces visitor preferences and identifies the install in Nirvani monitoring.
brandNamestring"This Site"Your brand, shown in the widget and on your statement page.
brandThemestring"mint"One of the 10 brand themes. Sets the accent, header and signature gradient.
accentColorhextheme accentOverrides the theme's solid accent color.
headerBgColorhextheme headerOverrides the panel header background.
positionstring"bottom-left""bottom-left", "bottom-right", "top-left" or "top-right".
badgePositionstring"top-right"Corner of the trigger button where the active-adjustments badge appears.
zIndexesobjectbuilt in{ trigger, panel, overlays } when your site has its own high stacking layers.

Links and contact

OptionTypeDefaultWhat it does
statementUrlstring"/accessibility#nirvani-controls"Your accessibility statement page. Download it ready-made from your install kit.
privacyUrlstring"/privacy-policy"Your privacy policy.
supportEmailstringnoneWhere visitors report an accessibility barrier.
supportPhonestringnonePhone line for accessibility feedback.

Tool groups

OptionTypeDefaultWhat it does
enableReadingToolsbooleantrueText size, spacing, fonts, reading guide, mask, bionic reading, magnifier.
enableColorToolsbooleantrueContrast modes, saturation, custom colors, color-blindness filters.
enableMotionControlsbooleantrueStop animations, reduce motion, pause autoplay, mute media, hide images.
enableCursorToolsbooleantrueLarge cursors, focus and hover highlights, 44 pixel targets, keyboard support.
enableScreenReaderToolsbooleanfalseAids that work alongside a visitor's own screen reader.
enableLanguageSelectorbooleantrueLets visitors switch among 40 interface languages.
enableGuidedSetupbooleantrueA short questionnaire that applies the right settings for the visitor.
enableVoiceControlbooleanfalseTurns on the AI Voice Navigator. The microphone listens only after a visitor clicks to start.
enableAnalyticsbooleanfalseCounts which tools each visitor uses, stored on their device only.

Security, privacy and operations

OptionTypeDefaultWhat it does
cspModestring"auto""auto", "nonce" or "hash". See Strict CSP.
styleNoncestringnonePer-request nonce stamped on every style the widget injects.
requireConsentbooleanfalseNothing is read from or written to storage until the visitor consents. See Consent mode.
enableHealthReportingbooleantrueSends the daily aggregate health summary. See Health reporting.
healthReportEndpointstringNirvani APIOverride for local development only.
cloudTtsobjectnoneStudio-quality voices for the AI Read-Aloud Narrator. See Cloud voices.
cloudAiobjectnoneConnects the AI Accessibility Assistant to an AI endpoint you control.
diagnosticbooleanfalseLogs the resolved config and environment on init. See Debugging.

Brand themes

Set brandTheme to the id closest to your brand. accentColor and headerBgColor still override the solid colors; the gradient follows the theme. Any color you set is darkened or lightened as needed so the text and controls drawn on it keep at least 4.5:1 contrast (7:1 for header text), in light and dark mode.

IdLook
mintNavy and sea-glass mint. The default, and the theme on this site.
cobaltRoyal blue on navy.
oceanSky blue on deep navy.
forestGreen on deep forest.
sunsetOrange on slate.
roseRose red on dark violet.
plumPurple on deep plum.
amberAmber on dark bronze.
obsidianBlack and champagne gold.
circuitSolid black chrome with electric blue and green.

Quick profiles

Seven one-tap profiles bundle the right settings. Each has a keyboard shortcut while the panel is open.

ProfileShortcutWhat it turns on
Reduce MotionAlt+Shift+1Stops animations and reduces motion.
Vision ClarityAlt+Shift+2Higher contrast, slightly larger text, highlighted headings.
Focus ModeAlt+Shift+3Reading guide, hover highlights and no animations.
Reading SupportAlt+Shift+4A readable font, taller lines, wider letter spacing and underlined links.
Keyboard SupportAlt+Shift+5Highlighted focus and keyboard helpers.
Screen Reader SupportAlt+Shift+6Highlighted headings and links with a readable font, alongside the visitor's screen reader.
Comfortable ReadingAlt+Shift+7Slightly larger content, taller lines, wider spacing and light contrast.

Visitors open and close the panel with Alt+A by default.

JavaScript API

The bundle registers one global, window.NirvaniAccess. Every method below is verified on each release in a real browser context before it ships.

MethodWhat it does
init(config)Validates the config and mounts the widget. Safe to call once per page.
mount(config) / unmount()Mounts or removes the widget without touching stored preferences.
reset(siteId?)Clears every adjustment for the site.
undo(siteId?) / canUndo(siteId?)Steps back through the visitor's recent adjustments.
getSettings(siteId?)Returns the visitor's current settings object.
getShareUrl(siteId?) / applyHashProfile(hash?)Encodes the visitor's setup into a shareable link, or applies one.
grantConsent() / revokeConsent() / hasConsent()Consent controls for requireConsent sites, for example from your cookie banner.
getStyleHashes()sha384 hashes of the injected styles for cspMode: "hash".
reportHealth(config?)Sends the aggregate health summary now instead of on the daily schedule.
Example: consent from your cookie banner

Strict CSP and SRI

Allow the Nirvani CDN and API in your policy:

Content-Security-Policy
script-src 'self' https://cdn.nirvani.dev;
style-src  'self' https://cdn.nirvani.dev 'nonce-{per-request}';
connect-src 'self' https://access-api.nirvani.dev;

Three injection modes

  • cspMode: "auto" (default) injects inline styles, stamped with styleNonce when you pass one.
  • cspMode: "nonce" requires styleNonce and fails closed without it. Generate the nonce per request on your server.
  • cspMode: "hash" writes all dynamic CSS into one style element. Read window.NirvaniAccess.getStyleHashes() and add each 'sha384-...' value to style-src.

Subresource integrity

The Nirvani Snippet Generator outputs integrity="sha384-..." and crossorigin="anonymous" attributes for the current bundle, so your security team can pin the exact file. A pinned hash locks that exact release: when Nirvani ships an update, refresh the hash from your install kit. Until you do, the browser declines the newer file and the guarded call keeps your page untouched. Unpinned installs update automatically.

With requireConsent: true, the widget works fully but keeps settings in memory only. Nothing is read from or written to storage, including usage counts, until the visitor accepts the inline prompt or you call grantConsent(). Healthcare and government presets turn this on by default.

Cloud voices and AI

Out of the box, the AI Read-Aloud Narrator uses the browser's built-in voices and the AI Accessibility Assistant runs on the visitor's device. To use studio-quality voices or a larger AI model, point the widget at endpoints you control:

Proxy endpoints
window.NirvaniAccess.init({
  siteId: "acme-corp",
  brandName: "Acme Corp",
  cloudTts: { provider: "proxy", endpoint: "https://api.acme.com/tts", apiKey: "", defaultLocale: "en-US" },
  cloudAi: { endpoint: "https://api.acme.com/assistant" }
});
Keep keys server-side. Everything in the config ships in your page. Your proxy adds provider credentials on the server, so apiKey stays empty. If an endpoint is unreachable, the widget falls back to browser voices and the on-device assistant.

Health reporting

Once a day, each install sends Nirvani an aggregate summary: counts, the widget version and basic configuration details. It never includes visitor settings, page content, audio or personal data, and it respects requireConsent. This feeds your AI Site Monitor. Set enableHealthReporting: false to opt out.

Debugging

Add ?nirvani-debug=1 to any page URL, or pass diagnostic: true, to log the resolved configuration and detected environment to the browser console. It is silent in production otherwise.

Versions and updates

The /access/v1/ path always serves the current release of version 1. Improvements reach every site on the next page load with no redeploy. Each release must pass a real-browser check before it ships, and the live bundle, stylesheet, language packs and API are checked every hour.

Ready to install? Your first month is $1, then $44 per site. Your install kit opens the moment payment completes. Start for $1.