UNPKG

@empathyco/x-components

Version:
46 lines (29 loc) 1.67 kB
--- title: 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 | | ------------------- | ----------------------------------------------------- | ------------------- | ------------- | | <code>result</code> | (Required) The @empathyco/x-types#Result information. | <code>Result</code> | <code></code> | ## Slots | Name | Description | Bindings<br />(name - type - description) | | -------------------- | ------------------------------------------------------ | ----------------------------------------- | | <code>default</code> | (Required) Button content with a text, an icon or both | None | ## Events A list of events that the component will emit: - [`UserClickedResultAddToCart`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts): the event is emitted after the user clicks the button. The event payload is the result data. ## 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` whe clicked by the user ```vue <BaseResultAddToCart :result="result"> <img src="./add-to-cart.svg" /> <span>Add to cart</span> </BaseResultAddToCart> ```