Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-trieve-search-component

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-trieve-search-component

The easiest way to get up and running in your app using trieve search.

  • 0.11.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
112
decreased by-85.51%
Maintainers
0
Weekly downloads
 
Created
Source

Trieve Search Component

The easiest way to get up and running in your app using trieve search.

How to use

Install using your favorite package manager:

yarn add trieve-search-component
# or
npm install trieve-search-component
# or
pnpm install trieve-search-component

After installing the first step is to instantiate a new TrieveSDK like so:

import { TrieveSDK } from "trieve-ts-sdk";

export const trieve = new TrieveSDK({
  apiKey: "<your-api-key>",
  datasetId: "<dataset-to-use>",
});

And then you can use any of the two components in your React application or as web component:

Search Modal

Screenshots

light closed dark closed light open

Usage in React:
<TrieveModalSearch trieve={trieve} />
Usage in Web Components:
initModalSearch({
  trieve: new TrieveSDK({
    // your options
  })
})


<trieve-modal-search />

If you are using it in JSX environment you will need to add the trieve-modal-search to the JSX attributes, for solid that would be:

declare module "solid-js" {
  namespace JSX {
    interface IntrinsicElements {
      "trieve-modal-search": {};
      "trieve-search": {};
    }
  }
}
Props
NameTypeDefault
datasetIdstring''
apiKeystring''
baseUrlstring"https://api.trieve.ai"
type"docs""ecommerce"
useGroupSearchbooleanfalse
chatbooleantrue
analyticsbooleantrue
placeholderstring"Search..."
onResultClick() => void() => {}
theme"light" or "dark""light"
searchOptionsAutocompleteReqPayload{ search_type: "fulltext" }
openKeyCombination{ key?: string; label?: string; ctrl?: boolean }[][{ ctrl: true }, { key: "k", label: "K" }]
ButtonElJSX.ElementTypenull
suggestedQueriesbooleantrue
defaultSearchQueriesstring[][]
defaultAiQuestionsstring[][]
brandLogoImgSrcUrlstringnull
brandNamestringnull
brand Colorstring#CB53EB
problemLinkstring (example: "mailto:help@trieve.ai?subject=")null
responsivebooleanfalse

Search Results

Screenshots

light dark

Usage in React:
<TrieveSearch apiKey="<your trieve apiKey>" datasetId="<your trieve datasetId" />
Usage in Web Components:
<trieve-search apiKey="<your trieve apiKey>" datasetId="<your trieve datasetId" />
Usage with Vanilla JS
    import { renderToDiv } from 'trieve-search-component/vanilla';
    const root = document.getElementById('root');
    renderToDiv(root, {
      apiKey: "<Your Trieve Api Key>"
      datasetId: "<Your Trieve Dataset Id>"
       // ... other props
    })
Props
NameTypeDefault
datasetIdstring''
apiKeystring''
placeholderstring"Search..."
onResultClick() => void() => {}
theme"light" or "dark""light"
searchOptionsSearchChunksReqPayload{ search_type: "hybrid" }

License

MIT

Development Guide

The example/ folder shows the example application for what rendering this would look like

Start the listener to update the search-component's css and javascript

$clients/search-component yarn
$clients/search-component yarn dev

Run the example application

$clients/search-component cd example/
$clients/search-component yarn
$clients/search-component yarn dev

FAQs

Package last updated on 15 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc