SearchView

A component that renders a search view, with input field and search reuslts.

Basic example

1import { SearchView } from '@markprompt/react';
2
3function Example() {
4  return (
5    <SearchView
6      projectKey="YOUR-PROJECT-KEY"
7      searchOptions={{ placeholder: 'Search docs' }}
8    />
9  );
10}

Component API

PropTypeDescriptionDefault
apiUrlstring

The base API URL.

projectKeystring

The project key associated to the project.

activeViewView

The active view.

onDidSelectResult() => void

Callback when a search result is selected.

onDidSelectAsk(query?: string) => void

Callback when chat is selected.

layoutMarkpromptOptions['layout']

Multi-pane layout when both search and chat are enabled.

"panels"
searchOptionsSubmitSearchQueryOptions & SearchOptions

Options for the search component.

linkAsstring | ComponentType<any>

Component to use in place of <a>.

"a"
debugboolean

Display debug info.

false