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
Name | Attribute Name | Description | Type | Default Value |
---|---|---|---|---|
anchorShape | anchor-shape | The shape of the anchor. | | "rectangle" | "circle" | "pill" | "rectangle" |
badgeSide | badge-side | The horizontal placement of the badge. | "left" | "right" | "right" |
badgeAlignment | badge-alignment | The vertical alignment of the badge. | "top" | "middle" | "top" |
Slots
Name | Value | Description |
---|---|---|
DEFAULT | - | The slot for the badge to be positioned. |
BADGE | badge | The 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";