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

PropTypeDescription
apiUrlstringThe base API URL.
projectKeystringThe project key associated to the project.
activeViewViewThe active view.
onDidSelectResult() => voidCallback when a search result is selected.
onDidSelectAsk(query?: string) => voidCallback when chat is selected.
layoutMarkpromptOptions['layout'] = "panels"Multi-pane layout when both search and chat are enabled.
searchOptionsSubmitSearchQueryOptions & SearchOptionsOptions for the search component.
linkAsstring | ComponentType<any> = "a"Component to use in place of <a>.
debugboolean = falseDisplay debug info.