Skip to content

Discount Card ​

A component for displaying discount cards with various appearances.

Importing ​

To use the discount card component, first you need to register the component inside the page. You can register the component manually by importing the register function:

ts
import { register } from "@tapsioss/web-components/discount-card";

register(); // Now the discount card component is ready to use!
ts
import { registerDiscountCard } from "@tapsioss/web-components";

registerDiscountCard(); // Now the discount card component is ready to use!

Also you can automatically register the component by importing it with the following approach:

ts
import "@tapsioss/web-components/discount-card/element";

TIP

If you want to use all the component in your app, you can call registerAll at the root of your project.

ts
import { registerAll } from "@tapsioss/web-components";

registerAll(); // All the components are now available

In the React package, you can easily add the component using the following code:

ts
import { DiscountCard } from "@tapsioss/react-components";

Component Usage ​

html
<tapsi-discount-card></tapsi-discount-card>
tsx
<DiscountCard />

Properties ​

NameAttribute NameDescriptionTypeDefault Value
headerTitleheader-titleThe header title of the discount card.string""
variantvariantThe variant of the discount card.| "clay"
| "whisper"
| "azure"
| "flame"
| "grayscale"
| "none"
"none"
titletitleThe title to use for the discount card.
Represents the title of the discount card.
string""
descriptiondescriptionThe description of the discount card.string""
badgeTextbadge-textThe name/text to display in the badge.string""
expiryDateLabelexpiry-date-labelThe label for the expiry date of the discount.string""
expiringexpiringCheck if discount is expiring and if expiring is
true then turn expiry date label into red color.
booleanfalse

Slots ​

NameValueDescription
ACTIONactionThe slot for header icon.
THUMBNAILthumbnailThe slot for header icon.
HEADER_ICONheader-iconThe slot for header icon.

TIP

The value of slots are available for developer as JavaScript Variables:

ts
// Option 1
import { DiscountCardSlots } from "@tapsioss/web-components";

// Option 2
import { Slots } from "@tapsioss/web-components/discount-card";
ts
// Option 1
import { DiscountCardSlots } from "@tapsioss/react-components";

// Option 2
import { Slots } from "@tapsioss/react-components/DiscountCard";

Created with 🧡