Documentation
Feedback
Guides
VTEX IO Apps

VTEX IO Apps
Discount Badge
vtex.store-components
Version: 3.119.6
Latest version: 3.178.2

This page is about version 3.119.6 of the app, which is not the most recent version. The latest stable version is 3.178.2.

Description

Discount Badge is a VTEX component that shows a discount of a product. This component can be imported and used by any VTEX App.

:loudspeaker: Disclaimer: Don't fork this project, use, contribute, or open issue with your feature request.

Table of Contents

Usage

You should follow the usage instruction in the main README.

To import it into your code:


_10
import { DiscountBadge } from 'vtex.store-components'

You can use it in your code like a React component with the jsx tag: <DiscountBadge />.


_10
<DiscountBadge listPrice={commertialOffer.ListPrice}
_10
sellingPrice={commertialOffer.Price}
_10
label={badgeText}>
_10
<img src="" alt="" />
_10
</DiscountBadge>

Configuration

Prop nameTypeDescription
listPriceNumber!Product's default price
sellingPriceNumber!Product's price with discount
labelStringLabel to track the discount percent
childrenNode!Element where the badge is displayed

Styles API

This app provides some CSS classes as an API for style customization. You should follow the Styles API instruction in the main README.

CSS namespaces

Below, we describe the namespaces that are defined in the DiscountBadge.

Class nameDescriptionComponent Source
discountContainerThe discount containerindex
discountInsideContainerThe discount inner containerindex
See also
Vtex.store Components
VTEX IO Apps
VTEX App Store
VTEX IO Apps