Widget · Overview
The Neuroon widget is an embeddable component that adds AI-powered semantic search to any online store. It integrates with a single <script> and isolates itself from the host theme via Shadow DOM, avoiding CSS and JavaScript collisions with your template.
It is designed for server-rendered integrations (WordPress, Magento, .NET, custom platforms). The host doesn't need any specific framework: any HTML page that can print a <script> and a <div> can embed it.
What it solves
- Semantic search with natural language, voice and image.
- Inline AI assistant with conversational answers and guided filters.
- Comparator, cross-sell on top of the cart and kit builder.
- Follow-up and memory keyed by
conversationId.
Stack
Preact 10.19 ─┐
TypeScript │
Tailwind v4 ├──► Bundle ~262 KB (gzip ~65 KB)
Vite 5 │
Framer Motion ─┘
- Preact instead of React to reduce bundle size (~3 KB vs ~45 KB).
- Shadow DOM in
openmode — the host can inspect the tree but theme styles do not leak in. - CSS inlined in the bundle — no extra network request for styles.
How it works
- The CDN loader registers
window.NeuroonWidgetand, when it finds a<script>withdata-token, automatically callsinit(auto-init). - The widget creates an isolated Shadow DOM in the declared container and injects the inline CSS.
- It resolves the theme (
auto/light/dark), applies the configuredStyleOverrides, registers theprefers-color-schemelistener and mounts the Preact tree inside the shadow root. - Every backend request carries the
X-Widget-Tokenheader.
Multi-instance
The widget supports several instances on the same page (one init per container). Each instance manages its own theme, global events and cleanup:
window.NeuroonWidget.getInstanceIds() // ['neuroon-widget-1', 'neuroon-widget-2']
window.NeuroonWidget.destroy('#header-search') // destroys only that instance
window.NeuroonWidget.destroy() // destroys all
Further reading
- Installation — script tag, SRI, recommended CSP policy.
- Configuration — every option (
data-attrsandNeuroonWidgetConfig). - Theming —
--nrn-*variables andStyleOverrides. - Widget events — what it emits and what it listens for from the host.
- Cart integration — how the host feeds the snapshot.