Skip to main content

CSS hooks

The script never ships a stylesheet. Everything you see is your Webflow styling — the script's only visual contribution is adding classes and data attributes you can style against.

That means two things. You can style any state without fighting specificity. And nothing changes appearance until you style it.

Classes you choose

Two class names are configurable on the script tag, because you have probably already designed the states in Webflow.

ClassSet withApplied to
is-activedata-activeclassA selected filter item
is-hiddendata-hideclassFilter items hidden behind a "show more" control

Design a combo class in Webflow with the matching name and it will be applied automatically. If your project already uses different names, point the script at them rather than renaming your classes.

Classes the script owns

These are internal bookkeeping. Style them if it helps, but do not rely on them as an API — they exist so the script can find and clean up its own work.

ClassMeaning
wf-algolia-injectedAn element the script cloned from one of your templates. It removes these on the next render.
wf-algolia-focusedThe keyboard-focused item in a dropdown
wf-algolia-page-numA generated page-number control
wf-algolia-sentinelThe invisible element infinite scroll watches
Do not hand-author wf-algolia-injected

The script clears every .wf-algolia-injected element before re-rendering. Putting that class on your own markup means the script will delete it.

Data attributes on result cards

Every rendered card carries the identity of the record it came from. These are what Insights uses for click and conversion attribution, and they are useful for your own analytics.

AttributeContains
data-wf-algolia-hit-objectidThe record's objectID
data-wf-algolia-hit-indexThe index the hit came from
data-wf-algolia-hit-queryidThe query that produced it, when click analytics are on
data-wf-algolia-hit-positionThe 1-based position in the result list
/* Style the first three results differently */
[data-wf-algolia-hit-position="1"] {}

Reading them from your own code:

const card = event.target.closest('[data-wf-algolia-hit-objectid]');
const objectID = card?.dataset.wfAlgoliaHitObjectid;

State attributes

AttributeMeaning
data-wf-algolia-activeThe element represents the current selection
data-wf-algolia-disabledThe control is present but cannot act yet
data-wf-algolia-stagedA selection is staged but not committed, in deferred-apply mode
data-wf-algolia-local-hiddenHidden by a client-side filter rather than by a query
data-wf-algolia-synthesizedGenerated by the script rather than cloned from your template
data-wf-algolia-overlay-resultA result rendered into an overlay surface
data-wf-algolia-hit-previewA preview card
data-wf-algolia-hrefThe resolved destination for a generated link

Styling a staged selection, for example:

[data-wf-algolia-staged] {
outline: 1px dashed currentColor;
}

Development helpers

AttributeMeaning
data-wf-algolia-debugEnables the development linter
data-wf-algolia-issueStamped on an element the linter has flagged