Skip to content

Conversation

GDamyanov
Copy link
Contributor

@GDamyanov GDamyanov commented Oct 2, 2025

This PR introduces the new contentMode property for the ui5-segmented-button component, allowing developers to control how segmented button items are sized:

  • EqualSized (default): All items are sized equally to fill the available space.
  • ContentFit: Each item fits its content, and any extra space is placed after the last item.

The change improves flexibility for use cases where item content varies in length and equal sizing is not desirable.

@ui5-webcomponents-bot
Copy link
Collaborator

ui5-webcomponents-bot commented Oct 2, 2025

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 10:46 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 12:26 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 12:43 Inactive
@GDamyanov GDamyanov changed the title feat(ui5-segmented-button): content behaviour feat(ui5-segmented-button): add api for content width behaviour Oct 2, 2025
@GDamyanov GDamyanov changed the title feat(ui5-segmented-button): add api for content width behaviour feat(ui5-segmented-button): add api for items content width behaviour Oct 2, 2025
@GDamyanov GDamyanov changed the title feat(ui5-segmented-button): add api for items content width behaviour feat(ui5-segmented-button): add api which controls items width behaviour Oct 2, 2025
@GDamyanov GDamyanov marked this pull request as ready for review October 2, 2025 12:58
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 13:03 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 2, 2025 17:37 Inactive
@GDamyanov GDamyanov requested a review from Copilot October 3, 2025 06:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new contentMode property for the ui5-segmented-button component that controls how button items are sized. The feature allows developers to choose between equal-sized items (default) or content-fitting items where each button sizes to its content.

  • Adds SegmentedButtonContentMode enum with EqualSized and ContentFit options
  • Implements CSS classes and styling for both sizing modes
  • Enhances tooltip behavior to show text content when no explicit tooltip is provided

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
SegmentedButtonContentMode.ts Defines the new enum for content mode values
SegmentedButton.ts Adds contentMode property and implements the sizing logic
SegmentedButton.css Adds CSS classes for different content modes
SegmentedButtonTemplate.tsx Updates template to use dynamic CSS class
SegmentedButtonItem.ts Adds slotTextContent getter for tooltip fallback
SegmentedButtonItemTemplate.tsx Updates tooltip to fallback to text content
SegmentedButton.html Adds test page examples for the new feature
SegmentedButton.cy.tsx Adds Cypress tests for content mode behavior

Comment on lines +187 to 190
if (this.contentMode === SegmentedButtonContentMode.EqualSized) {
this.style.setProperty(getScopedVarName("--_ui5_segmented_btn_items_count"), `${visibleItems.length}`);
}
}
Copy link
Preview

Copilot AI Oct 3, 2025

Choose a reason for hiding this comment

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

Missing closing brace for the if statement. The code block should be properly closed.

Copilot uses AI. Check for mistakes.

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 6, 2025 06:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 6, 2025 07:12 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 6, 2025 08:21 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 6, 2025 12:57 Inactive
Copy link
Contributor

@hinzzx hinzzx left a comment

Choose a reason for hiding this comment

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

In my opinion it would be a good idea to add sample, where we show the two new contentMode properties next to each other.

@GDamyanov
Copy link
Contributor Author

In my opinion it would be a good idea to add sample, where we show the two new contentMode properties next to each other.

Sample added in 81f7845

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 6, 2025 14:25 Inactive
@GDamyanov GDamyanov requested a review from hinzzx October 7, 2025 06:56
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 7, 2025 08:22 Inactive
Copy link
Contributor

@hinzzx hinzzx left a comment

Choose a reason for hiding this comment

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

You should also add the sample into the SegmentedButton.mdx file, in order to be available in the Playground.

@GDamyanov
Copy link
Contributor Author

0b0e558

Fixed in 0b0e558

@GDamyanov GDamyanov requested a review from hinzzx October 7, 2025 09:05
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 7, 2025 09:11 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview October 7, 2025 10:35 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.

3 participants