Trigger the Inkeep modal with a custom trigger (React)
Use the "Custom Trigger" if you want to use your own button, search bar, link, or any other UI element for opening and closing Inkeep's modal. This is an alternative to using the Inkeep SearchBar
or ChatButton
components.
Overview
The Inkeep modal can contain search, chat, or a combined experience.
The available modal components are:
Component | Description |
---|---|
InkeepModalSearchAndChat | Combined search and chat experience with a toggle for switching. |
InkeepModalSearch | Search-only experience |
InkeepModalChat | Chat-only experience |
Quick Start
Install the component library
Define the component
Lets start with the InkeepModalSearchAndChat
. To trigger the modal, you configure the isOpen
property to be true
or false
based on whether the user clicks on your own custom trigger.
Modal Settings
Modal settings control the behavior and interaction of modal components. These settings are passed in the modalSettings
prop.
Setting | Type | Default | Description |
---|---|---|---|
isOpen | boolean | false | Controls the visibility of the modal. Set to true to show the modal, false to hide it. |
onOpenChange | (isOpen: boolean) => void | - | Callback function triggered when the modal's open state changes. Useful for syncing state with your application. |
shortcutKey | string | null | - | The keyboard key that triggers the modal when pressed with Cmd (Mac) or Ctrl (Windows). Set to null to disable the shortcut. |
Modal Search
A modal version of the embedded search component. For detailed information about search functionality and available settings, see Embedded Search.
Modal Chat
A modal version of the embedded chat component. For detailed information about chat functionality and available settings, see Embedded Chat.
Component Methods
Chat Methods
Method | Description |
---|---|
submitMessage(message?: string) | Programmatically sends a message in chat. If message is omitted, sends the current input value. |
updateInputMessage(message: string) | Updates the text in chat input field |
clearChat() | Resets the chat to its initial state |
openForm(formSettings: FormSettings) | Displays a form overlay in chat interface |
focusInput() | Sets focus to the chat input field |
Refer to the Form Settings reference docs for more details on the available properties for the openForm
method.
Search methods
Method | Description |
---|---|
updateQuery(query: string) | Programmatically updates the search query. |
focusInput() | Sets focus to the search input field |
Widget methods
Method | Description |
---|---|
setView(view: ModalViewTypes) | Set the view of the widget to either search or chat |