-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat(ui5-button): add badge to ui5-button #10642
Conversation
Another API idea:
Variant 1:
Example: <ui5-button badge-design="AttentionDot">Messages</ui5-button>
<ui5-button badge-design="InlineText" badge-text="99+">Messages</ui5-button>
<ui5-button badge-design="OverlayText" badge-text="99+">Messages</ui5-button> Variant 2:
there is no Same as 1) but there is no Example: <ui5-button badge-design="AttentionDot">Messages</ui5-button>
<ui5-button badge-text="99+">Messages</ui5-button> <!-- inline by default as it works for cozy/compact -->
<ui5-button badge-text="99+" badge-design="OverlayText">Messages</ui5-button> Variant 3: We split the enum.
Example: <ui5-button attention-dot>Messages</ui5-button>
<ui5-button badge-text="99+">Messages</ui5-button> <!-- inline by default as it works for cozy/compact -->
<ui5-button badge-text="99+" badge-design="Overlay">Messages</ui5-button> Variant 4:
Same as 3) but the enum is now a boolean (which however sounds strange) Example: <ui5-button attention-dot>Messages</ui5-button>
<ui5-button badge-text="99+">Messages</ui5-button> <!-- inline by default as it works for cozy/compact -->
<ui5-button badge-text="99+" badge-text-overlaid>Messages</ui5-button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add website sample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I have a few very minor comments.
Let's discuss the idea of making the badge an optional feature tomorrow. We can do it exactly like in ColorPalette
- just import the extra template with the <ui5-tag>
dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that it's a separate component, add it in bundle.common.ts
after the Button import.
Approving new |
import type Button from "./Button.js"; | ||
import Tag from "./Tag.js"; | ||
|
||
export default function ButtonTemplate(this: Button) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here this
must be ButtonBadge
(but works with Button too, because they both have a text
property). We can fix this later in another PR along with something else, do not push again just for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 This PR is included in version v2.7.0-rc.2 🎉 The release is available on v2.7.0-rc.2 Your semantic-release bot 📦🚀 |
Implementing the badge concept in the
ui5-button
component.How to use:
The badge in
![Screenshot 2025-01-28 at 13 51 00](https://private-user-images.githubusercontent.com/11508737/407333483-49d87380-fde1-472d-86a0-d2ccdcace6ad.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTA5ODksIm5iZiI6MTczOTI1MDY4OSwicGF0aCI6Ii8xMTUwODczNy80MDczMzM0ODMtNDlkODczODAtZmRlMS00NzJkLTg2YTAtZDJjY2RjYWNlNmFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDA1MTEyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmMjI0N2MzYzBmYThkNzhjYTFkZjY3ZTE2MjZmNjYyOWU0YjMxYTI4ZDE4Yzc2NjBkMGFmMmVmM2NhNDhiYTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.9tVvJNpMyZtm7YD4QJ_PDwyLtPdBefiOIAsS_ovqRoU)
ui5-button
provides 3 designs:InlineText
,OverlayText
andAttentionDot
looking like:fixes: #10683