1. Create a Vue application
Run thenpm create
tool to install base dependencies and create your app folder structure.
2. Install the library of search components
Navigate to your Vue app and installvue-instantsearch
, @meilisearch/instant-meilisearch
, and instantsearch.css
.
- Vue InstantSearch: front-end tools to customize your search environment
- instant-meilisearch: Meilisearch client to connect with Vue InstantSearch
- instantsearch.css (optional): CSS library to add basic styles to the search components
3. Add InstantSearch
Include InstantSearch intomain.js
to include the Vue InstantSearch library.
4. Initialize the search client
Add the code below to theApp.vue
file.
ais-instant-search
widget is the mandatory wrapper that allows you to configure your search. It takes two props: the search-client
and the index-name
.
5. Add a search bar and list search results
Add theais-search-box
and ais-hits
widgets inside the ais-instant-search
wrapper widget.
Import the CSS library to style the search components.
Use the following CSS classes to add custom styles to your components:
.ais-InstantSearch
, .ais-SearchBox
, .ais-InfiniteHits-list
, .ais-InfiniteHits-item
6.Start the app and search as you type
Start the app by running:localhost:5173
), and start searching.
