Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
- button "Properties 5" [expanded]
- region "Properties 5": And here we have some content
- button "Documents"
- button "Graphics"
- region "Documents"
- button /Graphics \+\d+/
- region /Graphics \+\d+/
- banner:
- link "Siemens logo":
- /url: "#/"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 17 additions & 10 deletions projects/element-ng/accordion/si-collapsible-panel.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,29 @@
(click)="doToggle($event)"
>
@let headerIcon = icon();
@if (headerIcon) {
<si-icon class="icon ms-n2 me-2" [icon]="headerIcon" [class.collapsed-icon]="isHCollapsible" />
}
@if (icon() && badge() !== undefined && badge() !== '') {
<span class="badge-text">
{{ badge() }}
</span>
}
<span class="position-relative">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<span class="position-relative">
<span class="d-flex position-relative">

then you can remove the styling overrides of the badge-text

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure? it seems like I would still need the overrides

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with that it would be same as in the application-header.
I guess the problem is, that the icon size is wrong.

In header and navbar-vertical we have 24px (icon-lg).

Copy link
Member Author

@dauriamarco dauriamarco Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I change the icon size separately to 24px in the side-panel @panch1739? however, a part from that, I think the main issue would be the anchoring, meaning that the badge in this case should grow towards the left when multiple digits are present as the side-panel is aligned to the right of the screen, and that's why I used inset-inline-end instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that we would have different behavior of .badge-text. Can we change behavior in general?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree, I had a similar thought but I wasn't sure especially because, in addition to the css overrides, I had to change a little bit the template structure as well so it seemed complicated. But, anyway, I can think of a more general/flexible solution for the template structure and introducing something like .badge-text-left .badge-text-right or an additional .badge-left or .left / .badge-right or .right class for the alignment (?)

@if (headerIcon) {
<si-icon
class="icon ms-n2 me-2"
[icon]="headerIcon"
[class.collapsed-icon]="isHCollapsible"
/>

@if (formattedBadge()) {
<span class="badge-text">
{{ formattedBadge() }}
</span>
}
}
</span>
<div class="si-h5 autohide">
{{ heading() | translate }}
<ng-content select="[si-panel-heading]" />
</div>

@if (badge() !== undefined && badge() !== '') {
@if (formattedBadge()) {
<span [class]="'badge autohide' + (badgeColor() ? ' bg-' + badgeColor() : '')">
{{ badge() }}
{{ formattedBadge() }}
</span>
}
<span class="ms-auto overflow-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
}
}

.badge-text {
position: absolute;
inset-inline-end: -2px;
inset-inline-start: unset;
inset-block-start: -5px;
margin-inline-end: unset;
}

&.hcollapsed {
background: variables.$element-base-1;

Expand Down
14 changes: 14 additions & 0 deletions projects/element-ng/accordion/si-collapsible-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ export class SiCollapsiblePanelComponent {
*/
readonly panelToggle = output<boolean>();

/**
* Formats badge value to limit display to "+99" for numbers greater than 99
*/
protected readonly formattedBadge = computed(() => {
const badge = this.badge();
if (!badge && badge !== 0) {
return '';
}
if (typeof badge === 'number') {
return badge > 99 ? '+99' : badge.toString();
}
return badge.toString();
});

protected readonly hcollapsed = computed(
() => this.accordionHCollapseService?.hcollapsed() ?? false
);
Expand Down
2 changes: 1 addition & 1 deletion projects/element-theme/src/styles/bootstrap/_badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
background-color: semantic-tokens.$element-action-danger;
color: semantic-tokens.$element-action-danger-text;
font-size: typography.$si-font-size-caption;
line-height: 13px;
line-height: 1.2;
padding-block: 0;
padding-inline: map.get(spacers.$spacers, 2);
font-family: variables.$font-family-sans-serif;
Expand Down
10 changes: 8 additions & 2 deletions src/app/examples/si-side-panel/si-side-panel-collapsible.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,23 @@ <h2>Collapsible side panel</h2>
<si-accordion [fullHeight]="true">
<si-collapsible-panel
heading="Properties"
badge="5"
badgeColor="info"
icon="element-settings"
contentCssClasses="p-6"
[badge]="5"
>
And here we have some content
</si-collapsible-panel>
<si-collapsible-panel heading="Documents" icon="element-document" contentCssClasses="p-6">
And this is the content
</si-collapsible-panel>
<si-collapsible-panel heading="Graphics" icon="element-image" contentCssClasses="p-6">
<si-collapsible-panel
heading="Graphics"
badgeColor="warning"
icon="element-image"
contentCssClasses="p-6"
[badge]="100"
>
Nothing to see here
</si-collapsible-panel>
</si-accordion>
Expand Down
Loading