@empathyco/x-components
Version:
Empathy X Components
76 lines (55 loc) • 2.14 kB
Markdown
---
title: PartialQueryButton
---
A button that when pressed emits the XEventsTypes.UserAcceptedAQuery
and SearchXEvents.UserClickedPartialQuery events, expressing the user
intention to set the partial query.
| Name | Description | Type | Default |
| ------------------ | ------------------- | ------------------- | ------------- |
| <code>query</code> | The query property. | <code>string</code> | <code></code> |
| Name | Description | Bindings<br />(name - type - description) |
| -------------------- | ----------- | ----------------------------------------- |
| <code>default</code> | | |
This component emits 2 different events:
- [`UserAcceptedAQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):
the event is emitted after the user clicks the partial query. The event payload is the partial
query data.
- [`UserClickedPartialQuery`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):
the event is emitted after the user clicks the partial query. The event payload is the partial
query data.
A button that when pressed emits the `XEventsTypes.UserAcceptedAQuery` and
`SearchXEvents.UserClickedPartialQuery` events, expressing the user intention to set the partial
query.
The component sets the current query as the new query and emits the `UserAcceptedAQuery` and
`UserClickedPartialQuery` events when is clicked.
```vue
<template>
<PartialQueryButton :query="query" />
</template>
```
```vue
<template>
<PartialQueryButton>
<template
<span class="x-partial-query-button__text">
Set the Partial query as the new query: {{ query }}!
</span>
</template>
</PartialQueryButton>
</template>
<script>
import { PartialQueryButton } from '@empathyco/x-components/search'
export default {
components: {
PartialQueryButton,
},
}
</script>
```