Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Positioned feature for the Badge #6694

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

2mkabir
Copy link

@2mkabir 2mkabir commented Sep 23, 2023

Hello,

I'm introducing a new feature for the Badge component: the Positioned feature.

Please note that the "Positioned" feature is available in the core Bootstrap:
https://getbootstrap.com/docs/5.3/components/badge/#positioned

To implement this feature, I'm adding a new prop called positioned to the Badge component. Depending on the value of the pill prop, specific classes will be applied:

When pill is true, the following classes will be added:

position-absolute top-0 start-100 translate-middle

When pill is false, the following classes will be added:

position-absolute top-0 start-100 translate-middle border border-light rounded-circle

Also I added it to the docs examples:

Positioned

<Button variant="primary" className="me-4">
        Notifications <Badge bg="secondary">4</Badge>
        <span className="visually-hidden">unread messages</span>
</Button>
<Button variant="primary" className="position-relative me-4">
        Inbox <Badge positioned pill bg="danger">99+</Badge>
        <span className="visually-hidden">unread messages</span>
</Button>
<Button variant="primary" className="position-relative">
        Profile <Badge positioned bg="danger" className="p-2" />
        <span className="visually-hidden">New alerts</span>
</Button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant