Skip to content

Conversation

@kgogov
Copy link
Contributor

@kgogov kgogov commented Jan 20, 2026

Overview

Add ui5-avatar-badge component for visual affordance on avatars.
The badge displays icons with different value states to indicate status or notifications.

Features

  • Five value states: None (default), Positive, Critical, Negative, Information
  • Icon customization: Supports any icon from @ui5/webcomponents-icons
  • Invalid icon handling: Badge automatically hides when icon is empty or not found
  • RTL support: Uses CSS logical properties for proper right-to-left layout
  • Slot integration: Works seamlessly in the badge slot of ui5-avatar

Changes

  • Created dedicated AvatarBadge documentation page
  • Added usage examples and API documentation
  • Added tests for value states, sizes, shapes, and invalid icon handling

Usage

<ui5-avatar>
  <ui5-avatar-badge icon="edit" slot="badge"></ui5-avatar-badge>
</ui5-avatar>

Related Issues

Jira: BGSOFUIPIRIN-6975
Fixes #12396

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Jan 20, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 20, 2026 13:12 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 20, 2026 16:09 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 20, 2026 17:09 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 20, 2026 17:31 Inactive
@kgogov kgogov requested a review from kineticjs January 21, 2026 08:47
@kgogov kgogov force-pushed the feat-avatar-badge branch from 10de6f2 to 5a17c0b Compare January 22, 2026 12:31
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 22, 2026 12:37 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 22, 2026 17:37 Inactive
@kgogov kgogov force-pushed the feat-avatar-badge branch from f98089e to 28a0e03 Compare January 23, 2026 08:09
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 23, 2026 08:16 Inactive
Add `ui5-avatar-badge` component for visual affordance on avatars.
The badge displays icons with different value states to indicate status
or notifications.

Key features:
- Five value states (None, Positive, Critical, Negative, Information)
- RTL support with CSS logical properties
- Works in badge slot of `ui5-avatar`

Updated Avatar component to reference `ui5-avatar-badge` in badge
slot documentation.

Documentation structured following Button/ButtonBadge pattern with
dedicated AvatarBadge page marked as new component.

Fixes internal issue with avatar badge implementation.

Jira: BGSOFUIPIRIN-6975
Fixes #12396
- Move default styles to :host selector
- Remove redundant @SInCE tags from properties
- Remove CSS header comment
- Move icon styles to end of file for better organization
- Migrate disabled interaction test from ui5-tag to ui5-avatar-badge
- Fix typo in test ID (diabled -> disabled)
- Add comprehensive badge tests:
  - Badge rendering with icons
  - All five value states
  - Badge size for each avatar size (XS, S, M, L, XL)
  - Badge icon size for each avatar size
- Add required icon imports (accept, message-error, information, ai)
Badge now validates icon on render and hides itself
when icon is empty or not found in the icon registry.
Add test to verify AvatarBadge correctly hides itself when provided
with empty, missing, or non-existent icon names, and shows when valid.

Test covers:
- Empty icon string ("")
- Non-existent icon name ("non-existent-icon-xyz")
- No icon property set
- Valid icon ("accept") as reference

Uses direct DOM manipulation (document.createElement) instead of
cy.mount() because the Cypress UI5 plugin validates that mounted
components have shadow DOM content. Invalid badges intentionally
render empty shadow DOM (by design), which causes the plugin's
validation to fail. Direct DOM manipulation bypasses this limitation
while still allowing us to test the component behavior correctly.

Elements are cleaned up after test to prevent DOM pollution.
@kgogov kgogov force-pushed the feat-avatar-badge branch from 28a0e03 to 8854891 Compare January 26, 2026 14:03
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview January 26, 2026 14:09 Inactive
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.

[Avatar]: Difference between avatar with tag between version 1 and 2

4 participants