Autocomplete
Build a custom search interface by combining Glean’s Autocomplete and Search Results components
Create a full-featured search experience by integrating Glean’s Autocomplete and Search Results components. This approach enables deep UI customization while maintaining straightforward implementation.
Implementation Guide
Adding the JavaScript Client
Include the JavaScript library in your page’s <head>
section. Replace GLEAN_APP_DOMAIN
with your company’s Glean web app domain (typically app.glean.com
or your-company.glean.com
for custom subdomains).
The Glean web app domain differs from your company’s Glean backend domain (which typically follows the format your-company-be.glean.com
).
Component Setup
The implementation requires two container elements with specific CSS properties and event handling to coordinate the search experience:
-
Create container elements with the following CSS properties:
position: relative
display: block
- Appropriate sizing and positioning
-
Implement the search functionality with event handling:
Customization Options
Component APIs
The implementation provides extensive customization options through two primary APIs:
Theming
Customize the appearance using SearchBoxCustomizations. The theming system is regularly expanded with additional options based on customer needs.
Authentication
Authentication involves two default steps that users must complete upon first usage. However, both steps can be optimized for a smoother user experience.
Default Authentication Flow
- Email Address Entry
- SSO Authentication
Optimizing Authentication
You can streamline the authentication process in two ways:
-
Skip Email Entry: Implement the backend parameter to bypass the email entry step.
-
Skip SSO Authentication: Configure a server-to-server handshake and provide the user’s auth token via Options.authToken.
When implementing auth token authentication:
- You must configure an onAuthTokenRequired callback
- This callback handles token refresh when expiration approaches
- Server-to-server authentication becomes mandatory if third-party cookies are blocked in the user’s browser
Implementation Example
View a complete working implementation of the Autocomplete with Search components in our interactive demo:
Was this page helpful?