ais-voice-search
<ais-voice-search // Optional parameters :search-as-you-speak="boolean" :button-title="string" :disabled-button-title="string" :class-names="object" />
1
2
3
4
5
6
7
8
9
import { AisVoiceSearch } from 'vue-instantsearch';
// Use 'vue-instantsearch/vue3/es' for Vue 3
export default {
components: {
AisVoiceSearch
},
// ...
};
1. Follow additional steps in Optimize build size to ensure your code is correctly bundled.
2. This imports all the widgets, even the ones you don’t use. Read the Getting started guide for more information.
About this widget
The ais-voice-search
widget lets the user perform a voice-based query.
It uses the Web Speech API, which only Chrome (from version 25) has implemented so far. This means the voiceSearch
widget only works on desktop Chrome and Android Chrome. It doesn’t work on iOS Chrome, which uses the iOS WebKit.
Examples
1
<ais-voice-search />
Props
search-as-you-speak
|
type: boolean
default: false
Optional
Whether to trigger the search as you speak. If |
||
Copy
|
|||
button-title
|
type: string
default: 'Search by voice'
Optional
The |
||
Copy
|
|||
disabled-button-title
|
type: string
default: 'Search by voice (not supported on this browser)'
Optional
The |
||
Copy
|
|||
class-names
|
type: object
default: {}
Optional
The CSS classes to override.
|
||
Copy
|
Customize the UI
default
|
The slot to override the complete DOM output of the widget. Note that when you implement this slot, none of the other slots will change the output, as the default slot surrounds them. Scope
|
||
Copy
|
|||
buttonText
|
The slot to override the DOM output inside the button. Scope
|
||
Copy
|
|||
status
|
The slot to override the DOM output of the status. Scope
|
||
Copy
|
HTML output
1
2
3
4
5
6
7
8
<div class="ais-VoiceSearch">
<button class="ais-VoiceSearch-button" type="button" title="Search by voice">
...
</button>
<div class="ais-VoiceSearch-status">
...
</div>
</div>