Prefer using the Autocomplete widget from InstantSearch instead of the standalone Autocomplete library.
It integrates more closely with your search experience.
For more information,
see the API reference for InstantSearch.js or
React InstantSearch.
Installation
First, you need to install the theme.JavaScript
HTML
CSS variables
The theme uses CSS variables that you can customize in your own CSS.All colors are defined with two variables: one for the RGB values and one for
the alpha layer.
This lets you adjust each value independently.
Size and spacing
Z-index
Font
Icons
Text colors
Border colors
Background colors
Detached mode
Shadows
Scrollbar
To customize a value, you can create a custom style sheet and override the variable.
CSS
Templates
For the theme to work out of the box, you need to use a conventional CSS class set. All class names from the theme come with anaa- namespace to avoid interfering with your own styles.
Item
Here’s the markup for anitem template.
Link item
To wrap an item within a link, use the.aa-ItemLink class in place of the element with .aa-ItemWrapper.
Make sure not to use both together.
Header
Here’s the markup for aheader template.
No results
Here’s the markup for anoResults template.
JavaScript
Additional CSS classes
The theme provides a set of optional classes for you to use in different contexts.Modifiers
.aa-ItemIcon--noBorderremoves the border of the icon.aa-ItemIcon--alignTopaligns the icon to the top (recommended when the template is longer than three lines).aa-ItemIcon--picturemakes the icon larger (recommended when using an image and the template is longer than three lines).aa-Panel--scrollabledeclares the scrollable containers of the panel
Utilities
.aa-ActiveOnlydisplays an element only when the item is active.aa-DesktopOnlydisplays an element only on desktop devices.aa-TouchOnlydisplays an element only on tap devices
Dark mode
The theme supports dark mode. You can enable it on thebody tag in two different ways:
<body data-theme="dark" /><body class="dark" />