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.
- 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
siteIdper site. Visitor preferences are stored per site undernirvani_access_v1_{siteId}. - Single-page apps. Call
initonce. If your app swaps the whole<body>(Turbo, pjax), callinitagain 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
| Option | Type | Default | What it does |
|---|---|---|---|
siteId | string | "default" | Unique id for the site. Namespaces visitor preferences and identifies the install in Nirvani monitoring. |
brandName | string | "This Site" | Your brand, shown in the widget and on your statement page. |
brandTheme | string | "mint" | One of the 10 brand themes. Sets the accent, header and signature gradient. |
accentColor | hex | theme accent | Overrides the theme's solid accent color. |
headerBgColor | hex | theme header | Overrides the panel header background. |
position | string | "bottom-left" | "bottom-left", "bottom-right", "top-left" or "top-right". |
badgePosition | string | "top-right" | Corner of the trigger button where the active-adjustments badge appears. |
zIndexes | object | built in | { trigger, panel, overlays } when your site has its own high stacking layers. |
Links and contact
| Option | Type | Default | What it does |
|---|---|---|---|
statementUrl | string | "/accessibility#nirvani-controls" | Your accessibility statement page. Download it ready-made from your install kit. |
privacyUrl | string | "/privacy-policy" | Your privacy policy. |
supportEmail | string | none | Where visitors report an accessibility barrier. |
supportPhone | string | none | Phone line for accessibility feedback. |
Tool groups
| Option | Type | Default | What it does |
|---|---|---|---|
enableReadingTools | boolean | true | Text size, spacing, fonts, reading guide, mask, bionic reading, magnifier. |
enableColorTools | boolean | true | Contrast modes, saturation, custom colors, color-blindness filters. |
enableMotionControls | boolean | true | Stop animations, reduce motion, pause autoplay, mute media, hide images. |
enableCursorTools | boolean | true | Large cursors, focus and hover highlights, 44 pixel targets, keyboard support. |
enableScreenReaderTools | boolean | false | Aids that work alongside a visitor's own screen reader. |
enableLanguageSelector | boolean | true | Lets visitors switch among 40 interface languages. |
enableGuidedSetup | boolean | true | A short questionnaire that applies the right settings for the visitor. |
enableVoiceControl | boolean | false | Turns on the AI Voice Navigator. The microphone listens only after a visitor clicks to start. |
enableAnalytics | boolean | false | Counts which tools each visitor uses, stored on their device only. |
Security, privacy and operations
| Option | Type | Default | What it does |
|---|---|---|---|
cspMode | string | "auto" | "auto", "nonce" or "hash". See Strict CSP. |
styleNonce | string | none | Per-request nonce stamped on every style the widget injects. |
requireConsent | boolean | false | Nothing is read from or written to storage until the visitor consents. See Consent mode. |
enableHealthReporting | boolean | true | Sends the daily aggregate health summary. See Health reporting. |
healthReportEndpoint | string | Nirvani API | Override for local development only. |
cloudTts | object | none | Studio-quality voices for the AI Read-Aloud Narrator. See Cloud voices. |
cloudAi | object | none | Connects the AI Accessibility Assistant to an AI endpoint you control. |
diagnostic | boolean | false | Logs 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.
| Id | Look |
|---|---|
mint | Navy and sea-glass mint. The default, and the theme on this site. |
cobalt | Royal blue on navy. |
ocean | Sky blue on deep navy. |
forest | Green on deep forest. |
sunset | Orange on slate. |
rose | Rose red on dark violet. |
plum | Purple on deep plum. |
amber | Amber on dark bronze. |
obsidian | Black and champagne gold. |
circuit | Solid 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.
| Profile | Shortcut | What it turns on |
|---|---|---|
| Reduce Motion | Alt+Shift+1 | Stops animations and reduces motion. |
| Vision Clarity | Alt+Shift+2 | Higher contrast, slightly larger text, highlighted headings. |
| Focus Mode | Alt+Shift+3 | Reading guide, hover highlights and no animations. |
| Reading Support | Alt+Shift+4 | A readable font, taller lines, wider letter spacing and underlined links. |
| Keyboard Support | Alt+Shift+5 | Highlighted focus and keyboard helpers. |
| Screen Reader Support | Alt+Shift+6 | Highlighted headings and links with a readable font, alongside the visitor's screen reader. |
| Comfortable Reading | Alt+Shift+7 | Slightly 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.
| Method | What 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. |
Strict CSP and SRI
Allow the Nirvani CDN and API in your policy:
Three injection modes
cspMode: "auto"(default) injects inline styles, stamped withstyleNoncewhen you pass one.cspMode: "nonce"requiresstyleNonceand fails closed without it. Generate the nonce per request on your server.cspMode: "hash"writes all dynamic CSS into one style element. Readwindow.NirvaniAccess.getStyleHashes()and add each'sha384-...'value tostyle-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.
Consent mode
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:
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.