Appearance
Search Widget
Add an instant AI search modal to any website with a single script tag. The search widget is a Web Component (<semantic-search>) that runs in Shadow DOM — no CSS conflicts with your site. It attaches to your existing search input and returns semantic, typo-tolerant results as the user types.
Using WooCommerce or Shopify?
The WooCommerce plugin and the Shopify app embed and configure this widget for you. Use this page for custom integrations or advanced configuration.
Installation
Option 1: JS Config (recommended)
html
<script>
window.AppInSearch = {
apiKey: 'pk_live_your_public_key',
};
</script>
<script type="module" src="https://cdn.app-in.io/v1/search.js" async></script>Option 2: HTML Tag
html
<script type="module" src="https://cdn.app-in.io/v1/search.js"></script>
<semantic-search api-key="pk_live_your_public_key"></semantic-search>Use your public key (pk_live_...) — it's safe to expose in the browser. Find it in the dashboard under Site → API Keys.
Which option to choose?
JS Config — easier to manage, also exposes window.AppInSearch.open() / close(). HTML Tag — declarative, good for static HTML or a CMS template. Both options support the AI search button and the appin-search:open event.
Configuration
JS Config options
javascript
window.AppInSearch = {
apiKey: 'pk_live_...', // required — public key
apiUrl: 'https://api.app-in.io/v1', // API base URL (default shown)
platform: 'woocommerce', // backend platform → X-Platform header (default: none)
categoryId: '42', // scope results to a category (sent as category_id)
collectionId: '450123456789', // Shopify: show this collection first (sent as collection_id)
country: 'CH', // Shopify: shopper country for market prices (sent as country)
placeholder: 'Search products…', // input placeholder (default: localized)
showAllUrl: '/search?q={query}', // "Show all results" link; {query} is replaced
inputSelector: '.my-search', // CSS selector of your search input(s)
lang: 'en', // language for UI strings (default: auto-detect)
theme: 'light', // light (default) | dark
limit: 6, // max results in the dropdown (default 6)
};HTML attributes
html
<semantic-search
api-key="pk_live_..."
api-url="https://api.app-in.io/v1"
platform="woocommerce"
category-id="42"
placeholder="Search products…"
show-all-url="/search?q={query}"
input-selector=".my-search"
lang="en"
theme="dark"
limit="8"
></semantic-search>| Attribute | Config key | Default | Description |
|---|---|---|---|
api-key | apiKey | — | Required. Public key (pk_live_...) |
api-url | apiUrl | https://api.app-in.io/v1 | API base URL |
platform | platform | — | Backend platform, sent as the X-Platform header (woocommerce or shopify) |
category-id | categoryId | — | Scope results to a category (sent as numeric category_id) |
collection-id | collectionId | — | Shopify only. The numeric ID of a Shopify collection, sent as collection_id. Products from this collection come first. |
country | country | — | Shopify only. The shopper country as a two-letter code (for example CH), sent as country. The results then show the prices of that country. See Shopify market prices. |
placeholder | placeholder | localized | Search input placeholder; falls back to a lang-localized default |
show-all-url | showAllUrl | /?s={query} | "Show all results" link; {query} is replaced with the URL-encoded input |
input-selector | inputSelector | — | CSS selector of the search input(s) to attach to (added to the built-in defaults) |
lang | lang | auto-detected (UI only) | UI language (en, de, fr, es, it, nl, pl, cs, uk, ru, et, pt). When set, it is also sent as the search language. Set it to the language of the page and its products. See Language |
theme | theme | light | light or dark |
limit | limit | 6 | Maximum results shown in the dropdown |
Input detection
The widget attaches to common search inputs automatically. If your theme uses a custom field, pass its input-selector — it's added to the built-in selectors, not replacing them.
The widget ignores an input-selector that is not a valid CSS selector. It writes one warning to the browser console and keeps the built-in selectors.
Shopify storefronts
Set platform="shopify" on a Shopify storefront. The widget then also finds the search fields of Shopify themes. It also finds a search field that the theme adds after the page loads. When the shopper clicks the theme's search field, the widget closes the theme's own search panel and opens its modal.
Shopify market prices
A Shopify store can sell in several countries, each with its own prices and currency. Set country to the shopper's country. The API then returns the price, the currency and the stock of that country, and removes each product that the store does not sell there.
Sometimes the API cannot read the market prices. It then returns the store's base prices and market.localized: false. In that case the widget shows the base prices first. Then it asks the store's own Storefront API for the market prices, from the shopper's browser. When this works, the cards change to the market prices. When it fails, the base prices stay, and no product is removed.
Theming
Set theme="dark" for a dark modal, or fine-tune colors with CSS custom properties. These cross the Shadow DOM boundary, so you can set them from your site's CSS:
css
semantic-search {
--appin-primary: #37B7FF; /* accent color (buttons, highlights) */
--appin-surface: #FFFFFF; /* modal background */
--appin-text: #18181B; /* primary text */
--appin-text-secondary: #52525B; /* secondary text */
--appin-muted: #71717A; /* muted text */
--appin-subtle: #F4F4F5; /* subtle backgrounds / hover */
--appin-border: #E4E4E7; /* borders */
--appin-backdrop: rgba(0,0,0,0.5);/* overlay behind the modal */
}Auto (light/dark) matching
The widget honors an explicit theme only — it does not sniff the OS/browser theme, because "which theme this store wants" is the integrator's decision. The WooCommerce plugin's Auto appearance mode implements this by measuring the page background and setting theme for you.
AI search button
search.js also defines <semantic-search-button>: a ready-made button with a sparkle icon and the words "AI search" in the visitor's language. A click opens the search modal. Place it where you want it, for example inside the right end of your search field:
html
<form class="site-search" style="position: relative">
<input type="search" placeholder="What are you looking for?">
<semantic-search-button
style="position: absolute; right: 8px; top: 50%; transform: translateY(-50%)"
></semantic-search-button>
</form>The page still needs one <semantic-search> element (or the JS Config). The button only asks it to open.
| Attribute | Default | Description |
|---|---|---|
label | localized "AI search" | Button text, for example KI-Suche |
variant | icon-text | icon-text shows the icon and the text. icon shows only the icon; the text then becomes the button's aria-label |
The colour comes from --appin-primary:
css
semantic-search-button {
--appin-primary: #7c3aed; /* button background; text and icon are white */
}When the modal closes, the keyboard focus returns to the button.
JavaScript API
Open from your code
Dispatch appin-search:open on window to open the search modal. This works with both installation options:
javascript
window.dispatchEvent(new CustomEvent('appin-search:open'));Dispatch it after search.js has loaded. An event sent earlier is lost, and nothing opens.
window.AppInSearch
When using JS Config, methods are also exposed on window.AppInSearch:
javascript
window.AppInSearch.open(); // open the search modal
window.AppInSearch.close(); // close the search modalLanguage
lang does two things:
- UI language. The widget shows its UI strings (placeholder, "Show all results", status and error messages) in that language. AI-generated text (suggestions, clarifications) is localized by the API.
- Search language. The widget sends
langwith every search request. The API then shows only products in that language. When fewer than 3 products match, it searches again without the language filter. When your catalog has products in that language, the AI query parsing (when it is on for the site) also translates the query into it. Otherwise it uses the most common language of your catalog.
So set lang to the language of the page and its products, not only to the language of the interface. On a multilingual store, set it per page to the language the visitor is browsing in.
If lang is omitted, the widget picks its UI language from the browser and sends no search language. The search then covers every language of the catalog.
html
<semantic-search api-key="pk_live_..." lang="de"></semantic-search>Features
- Shadow DOM — full style isolation, no CSS conflicts
- Semantic + typo-tolerant — understands intent, not just keywords
- AI query parsing — extracts filters and sort from natural language
- Accessible — dialog semantics, focus trap, keyboard navigation, screen-reader announcements
- Typed error states — clear messages for auth, rate-limit, and service errors (not "no results")
- Responsive — works on mobile and desktop
Requirements
- A site with indexed products (Quick Start, the WooCommerce plugin or the Shopify app)
- A public key (
pk_live_...) from the dashboard - Your website domain must match the domain configured for the site in the dashboard