Skip to content
vviinn DocsDocs Beta

Search Page

Using the vviinn widgets as separate components gives you greater control over the layout and supports a wider range of use cases. For example, you can combine Text Search and Visual Search while refining results with filters, and display them on the same page or even on different pages.

This is the most common use case: the search component is on one page (e.g., the homepage), and results are displayed on a separate search results page. The Search & Results Page Redirects guide covers this setup step by step.

Set the results-page-url prop on the search component. The widget handles redirection and URL parameter passing automatically.

<!-- Homepage -->
<vviinn-text-search
token="YOUR_READ_ONLY_TOKEN"
mode="extended"
locale="en-US"
results-page-url="/search"
></vviinn-text-search>
<!-- Results page (/search) -->
<vviinn-text-search
token="YOUR_READ_ONLY_TOKEN"
mode="extended"
locale="en-US"
results-page-url="/search"
></vviinn-text-search>
<vviinn-filters></vviinn-filters>
<vviinn-extended-filters locale="en-US"></vviinn-extended-filters>
<vviinn-results
token="YOUR_READ_ONLY_TOKEN"
locale="en-US"
product-details-new-tab="true"
results-page-url="/search"
></vviinn-results>

For full control over the redirect logic, omit results-page-url and handle navigation yourself using events.

<!-- Homepage -->
<script>
document.addEventListener("vviinnTextSearchStarted", ({ detail }) => {
// Redirect using detail.query (text search)
});
document.addEventListener("vviinnImageUploadFinished", ({ detail }) => {
// Redirect using detail.searchId (image search)
});
</script>
<vviinn-text-search
token="YOUR_READ_ONLY_TOKEN"
mode="extended"
locale="en-US"
></vviinn-text-search>
<!-- Results page -->
<script>
// Get query or searchId from URL
</script>
<vviinn-filters></vviinn-filters>
<vviinn-extended-filters locale="en-US"></vviinn-extended-filters>
<!-- Text Search example: -->
<vviinn-text-search
token="YOUR_READ_ONLY_TOKEN"
mode="extended"
locale="en-US"
search-query="RECEIVED_QUERY"
></vviinn-text-search>
<vviinn-results
token="YOUR_READ_ONLY_TOKEN"
locale="en-US"
product-details-new-tab="true"
></vviinn-results>
<!-- Image Search example: -->
<vviinn-cropper token="YOUR_READ_ONLY_TOKEN" width="300"></vviinn-cropper>
<vviinn-text-search
token="YOUR_READ_ONLY_TOKEN"
mode="extended"
locale="en-US"
></vviinn-text-search>
<vviinn-results
token="YOUR_READ_ONLY_TOKEN"
search-id="RECEIVED_SEARCH_ID"
locale="en-US"
product-details-new-tab="true"
></vviinn-results>
Scenario Recommendation Component/Attribute
Automatic redirect to results page Set the results page URL — the widget handles redirect and URL parameters automatically <vviinn-text-search results-page-url="/search"> or results-page-url="https://shop.com/search"
Intercepting the redirect (SPA) Listen to the vviinnRedirect event and call preventDefault() to handle navigation yourself document.addEventListener("vviinnRedirect", ...)
Performing new searches on results page Don’t pass parameters again — components handle new queries automatically No attributes needed
Supporting page reloads (manual redirect) When handling the redirect manually, update the URL after each search using the browser History API so the page can be reloaded Use pushState() or replaceState()
Preserving uploaded image on reload Save the image between page reloads for Visual Search <vviinn-cropper save-image-mode="always">

To integrate the components into your project, install the vviinn-widgets package using one of the methods in the Installation section. You need at least version 2.76.1 of the package to use the components, but the latest version is recommended.

You can use the components in a framework-agnostic way or integrate them into your project with a specific framework. The components can be used together or separately, depending on your needs. They are highly customizable and suitable for a wide range of use cases.