Skip to content

fix(module:segmented): should render single element in item if icon-only - #9363

Merged
Laffery merged 1 commit into
NG-ZORRO:masterfrom
Laffery:fix/segmented-item-icon-only
Aug 28, 2025
Merged

Laffery merged 1 commit into
NG-ZORRO:masterfrom
Laffery:fix/segmented-item-icon-only

Conversation

@Laffery

@Laffery Laffery commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

image

What is the new behavior?

image

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@Nicoss54 Nicoss54 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Aug 28, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.21%. Comparing base (52322cd) to head (8d9dabb).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9363      +/-   ##
==========================================
- Coverage   92.25%   92.21%   -0.05%     
==========================================
  Files         561      561              
  Lines       19683    19680       -3     
  Branches     3015     3015              
==========================================
- Hits        18159    18148      -11     
- Misses       1192     1200       +8     
  Partials      332      332              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Laffery
Laffery merged commit 89d2168 into NG-ZORRO:master Aug 28, 2025
8 of 10 checks passed
@HyperLife1119

Copy link
Copy Markdown
Collaborator

This will cause the span element to be lost.

Expected behavior

image image

Current behavior

image image

@Laffery

Laffery commented Aug 29, 2025 •

Copy link
Copy Markdown
Collaborator Author

This will cause the span element to be lost.

Yes I also found this issue yesterday.

There seems to be no way to judge whether the ng-content contains content or not. Do you have any good suggestion about it?


From my perspective, I want to remove support for nzIcon if user customize the rendering template of nz-segmented-item in ng-content. Of course this brings breaking change:)

As compensation, we should add nzLabel property to nz-segmented-item, which accepts both string and TemplateRef types.

To be short, there are two individual ways for user to declare segmented items:

  • nzIcon + nzLabel
  • ng-content

WDYT?

@HyperLife1119

Copy link
Copy Markdown
Collaborator

I have a fix: #9367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants