Embedded Search (JS)
Add a search UI directly on a dedicated page
Overview
An "embedded search" is a search UI that is directly incorporated into a page instead of within a pop-up modal.
Quick start
Add the below <script>
tag to the <head>
or <body>
of your website.
Define an element in your page that will be the "container" for the embedded search.
Insert the Embedded Search by using the Inkeep.EmbeddedSearch()
function.
Embedded Search Props
This type represents the configuration for the Inkeep embedded search widget.
Prop | Type | Required | Description |
---|---|---|---|
baseSettings | object | Yes | Core configuration settings. See Base Settings for details. |
searchSettings | object | No | Search configuration settings. See Search Settings for details. |
isHidden | boolean | No | Whether to hide the search interface. Defaults to false. |
shouldAutoFocusInput | boolean | No | Whether to auto focus the input. Defaults to true. |
askAILabel | string | No | The label for the Ask AI button |
Examples
Auto Focus Input
With Search Settings
Refer to the Search Settings docs for more details on the available properties.
Changing props after initial render
Sometimes you may need to manage change settings after a widget has already been initialized, for example, to update user privacy preferences. To do this, you can use the update
method.
The below example illustrates how you change the primary color on the widget when a button is clicked.
Accessing search methods
The instance of the search object returned by Inkeep.EmbeddedSearch()
exposes some methods that you can use to interact with the search.
Method | Description |
---|---|
updateQuery(query: string) | Programmatically updates the search query. |
focusInput() | Sets focus to the search input field |