1 min read

BaseResultAddToCart

BaseResultAddToCart

Renders a button with a default slot. It receives the result with the data and emits XEventsTypes.UserClickedResultAddToCart to the bus on click mouse event.

Props

Name Description Type Default
result (Required) The @empathyco/x-types#Result information. Result

Slots

Name Description Bindings
(name - type - description)
default (Required) Button content with a text, an icon or both None

Events

A list of events that the component will emit:

Examples

Renders a button with a default slot. It receives the result with the data and emits an event UserClickedResultAddToCart to the bus on click mouse event.

Basic example

This component is a button to emit UserClickedResultAddToCart when clicked by the user.

<template>
  <BaseResultAddToCart :result="result">
    <img src="./add-to-cart.svg" alt="Add to cart" />
    <span>Add to cart</span>
  </BaseResultAddToCart>
</template>
<script setup>
import { BaseResultAddToCart } from '@empathyco/x-components'
const result = {
  id: '123',
  name: 'Product name',
  price: 19.99,
  // ...other result properties
}
</script>