Embedded Search (React)
Add a search UI directly on a dedicated React powered 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
Install the component library
Define the component
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
Accessing Component Methods
The searchSettings
config accepts a searchFunctionsRef
prop that allows you to access the search methods.
Method | Description |
---|---|
updateQuery(query: string) | Programmatically updates the search query. |
focusInput() | Sets focus to the search input field |
FAQ
If you use a webpack
build. You could come across this error.
To fix this you need to create a custom loader for your webpack configuration to disable
this behavior.
Since webpack 5.0.0-beta.30, you're required to specify extensions when using imports in .mjs files or any .js files with a package.json with "type": "module". You can still disable the behavior with resolve.fullySpecified set to false if you see any related errors in your project.
We can add a new rule to our webpack configuration to disable this behavior.
Then add this to your webpack.config.js
file.
If you use docusaurus, you can add this to your docusaurus.config.js
file as a webpack
config override with plugins.