Skip to content

Badge Wrapper

A wrapper component to position a badge relative to an anchor.

Importing

To use the badge wrapper 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/badge-wrapper";

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

registerBadgeWrapper(); // Now the badge wrapper component is ready to use!

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

ts
import "@tapsioss/web-components/badge-wrapper/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 { BadgeWrapper } from "@tapsioss/react-components";

Component Usage

html
<tapsi-badge-wrapper></tapsi-badge-wrapper>
tsx
<BadgeWrapper />

Properties

NameAttribute NameDescriptionTypeDefault Value
anchorShapeanchor-shapeThe shape of the anchor.| "rectangle"
| "circle"
| "pill"
"rectangle"
badgeSidebadge-sideThe horizontal placement of the badge."left" | "right""right"
badgeAlignmentbadge-alignmentThe vertical alignment of the badge."top" | "middle""top"

Slots

NameValueDescription
DEFAULT-The slot for the badge to be positioned.
BADGEbadgeThe slot for the badge to be positioned.

TIP

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

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

// Option 2
import { Slots } from "@tapsioss/web-components/badge-wrapper";
ts
// Option 1
import { BadgeWrapperSlots } from "@tapsioss/react-components";

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

Created with 🧡